Represents a color value what is stored inside a 32 bit integer.
The supported format is RGBA
, so it uses one Byte
per red
, green
, blue
and alpha
channel into order.
Static variables
staticluminanceF:Float
Luminance from 0.0 to 1.0, get: (r+g+b)/3, set: each color will set to this value
staticdefaultNames:Array<String> = ["Black", "White", "Grey", "Grey1", "Grey2", "Grey3", "Grey4", "Grey5", "Grey6", "Grey7", "Red", "Red1", "Red2", "Red3", "Green", "Green1", "Green2", "Green3", "Blue", "Blue1", "Blue2", "Blue3", "Cyan", "Magenta", "Yellow", "Gold", "Orange", "Brown", "Purple", "Pink", "Lime"]
An array of all default static color names as String
s.
staticdefaultMap:Map<String, Color> = ["Black" => BLACK, "White" => WHITE, "Grey" => GREY, "Grey1" => GREY1, "Grey2" => GREY2, "Grey3" => GREY3, "Grey4" => GREY4, "Grey5" => GREY5, "Grey6" => GREY6, "Grey7" => GREY7, "Red" => RED, "Red1" => RED1, "Red2" => RED2, "Red3" => RED3, "Green" => GREEN, "Green1" => GREEN1, "Green2" => GREEN2, "Green3" => GREEN3, "Blue" => BLUE, "Blue1" => BLUE1, "Blue2" => BLUE2, "Blue3" => BLUE3, "Yellow" => YELLOW, "Magenta" => MAGENTA, "Cyan" => CYAN, "Gold" => GOLD, "Orange" => ORANGE, "Brown" => BROWN, "Purple" => PURPLE, "Pink" => PINK, "Lime" => LIME]
A map of all default static color values where the keys are the names as String
s.
Static methods
staticinlinesetARGB(this:Int, a:Int, r:Int, g:Int, b:Int):Color
Set multiple components by integers (0 to 255) and return the resulting color.
Parameters:
a | alpha |
---|---|
r | red |
g | green |
b | blue |
staticinlinesetRGBA(this:Int, r:Int, g:Int, b:Int, a:Int):Color
Set multiple components by integers (0 to 255) and return the resulting color.
Parameters:
r | red |
---|---|
g | green |
b | blue |
a | alpha |
staticinlinesetRGB(this:Int, r:Int, g:Int, b:Int):Color
Set multiple components by integers (0 to 255) and return the resulting color.
Parameters:
r | red |
---|---|
g | green |
b | blue |
staticinlinesetLuminanceAlpha(this:Int, lum:Int, a:Int):Color
Set multiple components by integers (0 to 255) and return the resulting color.
Parameters:
lum | luminance |
---|---|
a | alpha |
staticinlinesetRed(this:Int, r:Int):Color
Set red color by integer (0 to 255) and return the resulting color.
Parameters:
r | red |
---|
staticinlinesetGreen(this:Int, g:Int):Color
Set green color by integer (0 to 255) and return the resulting color.
Parameters:
g | green |
---|
staticinlinesetBlue(this:Int, b:Int):Color
Set blue color by integer (0 to 255) and return the resulting color.
Parameters:
b | blue |
---|
staticinlinesetAlpha(this:Int, a:Int):Color
Set alpha by integer (0 to 255) and return the resulting color.
Parameters:
a | alpha |
---|
staticinlinesetLuminance(this:Int, lum:Int):Color
Set luminance by integer (0 to 255) and return the resulting color.
Parameters:
lum | luminance |
---|
staticinlinesetFloatARGB(this:Int, a:Float, r:Float, g:Float, b:Float):Color
Set multiple components by float values (0.0 to 1.0) and return the resulting color.
Parameters:
a | alpha |
---|---|
r | red |
g | green |
b | blue |
staticinlinesetFloatRGBA(this:Int, r:Float, g:Float, b:Float, a:Float):Color
Set multiple components by float values (0.0 to 1.0) and return the resulting color.
Parameters:
r | red |
---|---|
g | green |
b | blue |
a | alpha |
staticinlinesetFloatRGB(this:Int, r:Float, g:Float, b:Float):Color
Set multiple components by float values (0.0 to 1.0) and return the resulting color.
Parameters:
r | red |
---|---|
g | green |
b | blue |
staticinlinesetFloatLuminanceAlpha(this:Int, lum:Float, a:Float):Color
Set multiple components by float values (0.0 to 1.0) and return the resulting color.
Parameters:
lum | luminance |
---|---|
a | alpha |
staticinlinesetFloatRed(this:Int, r:Float):Color
Set red color by float value (0.0 to 1.0) and return the resulting color.
Parameters:
r | red |
---|
staticinlinesetFloatGreen(this:Int, g:Float):Color
Set green color by float value (0.0 to 1.0) and return the resulting color.
Parameters:
g | green |
---|
staticinlinesetFloatBlue(this:Int, b:Float):Color
Set blue color by float value (0.0 to 1.0) and return the resulting color.
Parameters:
b | blue |
---|
staticinlinesetFloatAlpha(this:Int, a:Float):Color
Set alpha by float value (0.0 to 1.0) and return the resulting color.
Parameters:
a | alpha |
---|
staticinlinesetFloatLuminance(this:Int, lum:Float):Color
Set luminance by float value (0.0 to 1.0) and return the resulting color.
Parameters:
lum | luminance |
---|
staticinlineARGB(a:Int, r:Int, g:Int, b:Int):Color
Create a new color by integers (0 to 255).
Parameters:
a | alpha |
---|---|
r | red |
g | green |
b | blue |
staticinlineRGBA(r:Int, g:Int, b:Int, a:Int):Color
Create a new color by integers (0 to 255).
Parameters:
r | red |
---|---|
g | green |
b | blue |
a | alpha |
staticinlineRGB(r:Int, g:Int, b:Int):Color
Create a new color by integers (0 to 255).
Parameters:
r | red |
---|---|
g | green |
b | blue |
staticinlineLuminanceAlpha(lum:Int, a:Int):Color
Create a new color by integers (0 to 255).
Parameters:
lum | luminance |
---|---|
a | alpha |
staticinlineRed(r:Int):Color
Create a new color by set the red value as integer (0 to 255).
Parameters:
r | red |
---|
staticinlineGreen(g:Int):Color
Create a new color by set the green value as integer (0 to 255).
Parameters:
g | green |
---|
staticinlineBlue(b:Int):Color
Create a new color by set the blue value as integer (0 to 255).
Parameters:
b | blue |
---|
staticinlineAlpha(a:Int):Color
Create a new color by set the alpha value as integer (0 to 255).
Parameters:
a | alpha |
---|
staticinlineLuminance(lum:Int):Color
Create a new color by set the luminance value as integer (0 to 255).
Parameters:
lum | luminance |
---|
staticinlineFloatARGB(a:Float, r:Float, g:Float, b:Float):Color
Create a new color by float values (0.0 to 1.0).
Parameters:
a | alpha |
---|---|
r | red |
g | green |
b | blue |
staticinlineFloatRGBA(r:Float, g:Float, b:Float, a:Float):Color
Create a new color by float values (0.0 to 1.0).
Parameters:
r | red |
---|---|
g | green |
b | blue |
a | alpha |
staticinlineFloatRGB(r:Float, g:Float, b:Float):Color
Create a new color by float values (0.0 to 1.0).
Parameters:
r | red |
---|---|
g | green |
b | blue |
staticinlineFloatLuminanceAlpha(lum:Float, a:Float):Color
Create a new color by float values (0.0 to 1.0).
Parameters:
lum | luminance |
---|---|
a | alpha |
staticinlineFloatRed(r:Float):Color
Create a new color by set the red value as float (0.0 to 1.0).
Parameters:
r | red |
---|
staticinlineFloatGreen(g:Float):Color
Create a new color by set the green value as float (0.0 to 1.0).
Parameters:
g | green |
---|
staticinlineFloatBlue(b:Float):Color
Create a new color by set the blue value as float (0.0 to 1.0).
Parameters:
b | blue |
---|
staticinlineFloatAlpha(a:Float):Color
Create a new color by set the alpha value as float (0.0 to 1.0).
Parameters:
a | alpha |
---|
staticinlineFloatLuminance(lum:Float):Color
Create a new color by set the luminance value as float (0.0 to 1.0).
Parameters:
lum | luminance |
---|
staticinlinemix(fromColor:Color, toColor:Color, step:Float):Color
Returns a mix of 2 colors at a step between 0.0 and 1.0
Parameters:
fromColor | the color at step 0.0 |
---|---|
toColor | the color at step 1.0 |
staticinlineHSV(hue:Float, saturation:Float, value:Float, alpha:Float = 1.0):Color
Create a new color in HSV colorspace.
Parameters:
hue | Hue from 0.0 (0°) to 1.0 (360°) |
---|---|
saturation | Saturation (from 0.0 to 1.0) |
value | Brightness (from 0.0 to 1.0) |
alpha | Alpha component from 0.0 (full transparent) to 1.0 (opaque) |
staticinlineHSL(hue:Float, saturation:Float, luminance:Float, alpha:Float = 1.0):Color
Create a new color in HSL colorspace.
Parameters:
hue | Hue from 0.0 (0°) to 1.0 (360°) |
---|---|
saturation | Saturation (from 0.0 to 1.0) |
luminance | Luminance (from 0.0 to 1.0) |
alpha | Alpha component from 0.0 (full transparent) to 1.0 (opaque) |
staticinlinernd(fromColor:Color, toColor:Color):Color
Create a random color into range (randomize between each compoments)
Parameters:
fromColor | where it starts |
---|---|
toColor | where it ends |
alpha | to set a value for alpha (by default it is also randomized into range) |
staticinlinerandom(?alpha:Int):Color
Create a random color.
Parameters:
alpha | to set a value for alpha (by default it is also randomized) |
---|
staticinlinerandomize(this:Int, ?alpha:Int):Void
Set the color to a random value.
Parameters:
alpha | to set a value for alpha (by default it is also randomized) |
---|
staticinlinetoGLSL(this:Int):String
To create a string where the color is defined as vec4(...)
to use inside of glsl-code.