class Colors::ColorValue

Overview

The value one primary color has out of a RGB color.

Defined in:

colors/color_value.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(value : UInt8 = MIN_INTENSITY) #

[View source]
def self.new(value : AnyNumber | ColorValue) #

Create a ColorValue from a number or another color value.

Raises OverflowError if the value won't fit in a UInt8; I.E. if the value is less than 0 or greater than 255, or not an integer; E.G. 3.0, 100u64, 255f64, or ColorValue::new(100u8) are acceptable parameters, -1, 256u16, or 123.456 will throw.


[View source]
def self.new(value : String = "0") #

Create a ColorValue from a string representation: either a hexadecimal numeric value between 0 and 255, or the words "full" or "off" which translate to MAX_INTENSITY and MIN_INTENSITY, respectively.

Raises if the value isn't a valid base-16 integer which fits into 8 bits, unsigned.


[View source]

Class Method Detail

def self.full #

[View source]
def self.max #

[View source]
def self.min #

[View source]
def self.off #

[View source]

Instance Method Detail

def %(other) #

Defines a new color where this color % other


[View source]
def &(other) #

Defines a new color where this color & other


[View source]
def *(other) #

Defines a new color where this color * other


[View source]
def +(other) #

Defines a new color where this color + other


[View source]
def -(other) #

Defines a new color where this color - other


[View source]
def /(other) #

Defines a new color where this color / other


[View source]
def <(other) #

[View source]
def <=(other) #

[View source]
def ==(other) #
Description copied from class Reference

Returns false (other can only be a Value here).


[View source]
def >(other) #

[View source]
def >=(other) #

[View source]
def ^(other) #

Defines a new color where this color ^ other


[View source]
def |(other) #

Defines a new color where this color | other


[View source]
def abs : UInt8 #

[View source]
def to_f #

[View source]
def to_i #

[View source]
def to_s(io) #

[View source]
def to_u8 : UInt8 #

[View source]