class Colors::ColorValue
- Colors::ColorValue
- Reference
- Object
Overview
The value one primary color has out of a RGB color.
Defined in:
colors/color_value.crConstructors
- .new(value : UInt8 = MIN_INTENSITY)
-
.new(value : AnyNumber | ColorValue)
Create a
ColorValue
from a number or another color value. -
.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 toMAX_INTENSITY
andMIN_INTENSITY
, respectively.
Class Method Summary
Instance Method Summary
-
#%(other)
Defines a new color where this color % other
-
#&(other)
Defines a new color where this color & other
-
#*(other)
Defines a new color where this color * other
-
#+(other)
Defines a new color where this color + other
-
#-(other)
Defines a new color where this color - other
-
#/(other)
Defines a new color where this color / other
- #<(other)
- #<=(other)
-
#==(other)
Returns
false
(other can only be aValue
here). - #>(other)
- #>=(other)
-
#^(other)
Defines a new color where this color ^ other
-
#|(other)
Defines a new color where this color | other
- #abs : UInt8
- #to_f
- #to_i
- #to_s(io)
- #to_u8 : UInt8
Constructor Detail
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.
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.
Class Method Detail
Instance Method Detail
Returns false
(other can only be a Value
here).