struct Novika::Color
- Novika::Color
- Struct
- Value
- Object
Included Modules
Defined in:
novika/forms/color.crConstructors
-
.hsl(h : Decimal, s : Decimal, l : Decimal) : Color
Creates a
Color
from hue (0 <= h <= 360, degrees), saturation (0 <= s <= 100, percents), and lightness (0 <= l <= 100, percents). -
.hsv(h, s, v) : Color
Creates a
Color
from hue (0 <= h <= 360, degrees), saturation (0 <= s <= 100, percents), and value (0 <= v <= 100, percents). -
.lch(l : Decimal, c : Decimal, h : Decimal) : Color
Creates a
Color
from lightness (0-100), chroma (0-132), hue (0-360). -
.rgb(r : Decimal, g : Decimal, b : Decimal) : Color
Creates a
Color
from red (0 <= h <= 255), green (0 <= g <= 255), blue (0 <= b <= 255) channel values.
Class Method Summary
-
.rgb(r, g, b)
Creates a
Color
from red (0 <= h <= 255), green (0 <= g <= 255), blue (0 <= b <= 255) channel values. - .typedesc
Instance Method Summary
-
#a : Decimal
Holds alpha channel value decimal (0-255).
-
#a=(a : Decimal)
Holds alpha channel value decimal (0-255).
-
#b : Decimal
Returns blue channel value decimal (0-255).
-
#closest(palette : Array(Color))
Returns the color closest to this color from palette.
- #desc(io)
-
#g : Decimal
Returns green channel value decimal (0-255).
-
#hsl : Tuple(Decimal, Decimal, Decimal)
Returns a tuple with H, S, L of this color.
-
#hsv : Tuple(Decimal, Decimal, Decimal)
Returns a tuple with H, S, V of this color.
-
#lch : Tuple(Decimal, Decimal, Decimal)
Returns a tuple with L, C, H of this color.
-
#r : Decimal
Returns red channel value decimal (0-255).
-
#rgb : Tuple(Decimal, Decimal, Decimal)
Returns a tuple of R, G, B channel values.
- #to_s(io)
Instance methods inherited from module Novika::Form
a(type : T.class) : T forall T
a,
desc(io : IO)desc : String desc, die(details : String) die, effect(io)
effect effect, on_open(engine : Engine) : self on_open, on_parent_open(engine : Engine) : self on_parent_open, onto(block : Block) : self onto, sel(a, b) sel, to_quote : Quote to_quote
Instance methods inherited from module Novika::Schedulable
schedule(engine : Engine, stack : Block)
schedule,
schedule!(engine : Engine, stack : Block)
schedule!
Constructor Detail
Creates a Color
from hue (0 <= h <= 360, degrees),
saturation (0 <= s <= 100, percents), and lightness
(0 <= l <= 100, percents).
Creates a Color
from hue (0 <= h <= 360, degrees),
saturation (0 <= s <= 100, percents), and value
(0 <= v <= 100, percents).
Creates a Color
from red (0 <= h <= 255), green
(0 <= g <= 255), blue (0 <= b <= 255) channel values.
Class Method Detail
Creates a Color
from red (0 <= h <= 255), green
(0 <= g <= 255), blue (0 <= b <= 255) channel values.
Instance Method Detail
Holds alpha channel value decimal (0-255).
You can mutate this to set alpha, but do remember that
Color
is a struct.
Holds alpha channel value decimal (0-255).
You can mutate this to set alpha, but do remember that
Color
is a struct.
Returns the color closest to this color from palette.
How close one color is to another is determined by their distance in an HSV-backed coordinate system.