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

staticr:Int

Red color component from 0 to 255

staticg:Int

Green color component from 0 to 255

staticb:Int

Blue color component from 0 to 255

statica:Int

Alpha component from 0 (full transparent) to 255 (opaque)

staticrgb:Int

Get or set only the color channels into RGB byteorder

staticargb:Int

Get or set the color into ARGB byteorder

staticred:Int

Red color component from 0 to 255

staticgreen:Int

Green color component from 0 to 255

staticblue:Int

Blue color component from 0 to 255

staticalpha:Int

Alpha component from 0 (full transparent) to 255 (opaque)

staticluminance:Int

Luminance from 0 to 255, get: (r+g+b)/3, set: each color will set to this value

staticrF:Float

Red color component from 0.0 to 1.0

staticgF:Float

Green color component from 0.0 to 1.0

staticbF:Float

Blue color component from 0.0 to 1.0

staticaF:Float

Alpha component from 0.0 (full transparent) to 1.0 (opaque)

staticredF:Float

Red color component from 0.0 to 1.0

staticgreenF:Float

Green color component from 0.0 to 1.0

staticblueF:Float

Blue color component from 0.0 to 1.0

staticalphaF:Float

Alpha component from 0.0 (full transparent) to 1.0 (opaque)

staticluminanceF:Float

Luminance from 0.0 to 1.0, get: (r+g+b)/3, set: each color will set to this value

staticread onlyrgbMax:Int

The maximum of red, green and blue color integer values (0 to 255).

staticread onlyrgbMin:Int

The minimum of red, green and blue color integer values (0 to 255).

staticread onlyrgbMaxF:Float

The maximum of red, green and blue color float values (0.0 to 1.0).

staticread onlyrgbMinF:Float

The minimum of red, green and blue color float values (0.0 to 1.0).

statichue:Float

The hue value inside HSV and HSL colorspace (0.0 to 1.0).

staticsaturationHSV:Float

The saturation value inside the HSV colorspace (0.0 to 1.0).

staticsaturationHSL:Float

The saturation inside the HSL colorspace (0.0 to 1.0).

staticvalueHSV:Float

The value inside the HSV colorspace (0.0 to 1.0).

staticluminanceHSL:Float

The luminance inside the HSL colorspace (0.0 to 1.0).

@:value(0x000000ff)staticinlineread onlyBLACK:Color = 0x000000ff

@:value(0xffffffff)staticinlineread onlyWHITE:Color = 0xffffffff

@:value(0x7f7f7fff)staticinlineread onlyGREY:Color = 0x7f7f7fff

@:value(0x1f1f1fff)staticinlineread onlyGREY1:Color = 0x1f1f1fff

@:value(0x3f3f3fff)staticinlineread onlyGREY2:Color = 0x3f3f3fff

@:value(0x5f5f5fff)staticinlineread onlyGREY3:Color = 0x5f5f5fff

@:value(0x7f7f7fff)staticinlineread onlyGREY4:Color = 0x7f7f7fff

@:value(0x9f9f9fff)staticinlineread onlyGREY5:Color = 0x9f9f9fff

@:value(0xbfbfbfff)staticinlineread onlyGREY6:Color = 0xbfbfbfff

@:value(0xdfdfdfff)staticinlineread onlyGREY7:Color = 0xdfdfdfff

@:value(0xff0000ff)staticinlineread onlyRED:Color = 0xff0000ff

@:value(0x3f0000ff)staticinlineread onlyRED1:Color = 0x3f0000ff

@:value(0x7f0000ff)staticinlineread onlyRED2:Color = 0x7f0000ff

@:value(0xbf0000ff)staticinlineread onlyRED3:Color = 0xbf0000ff

@:value(0x00ff00ff)staticinlineread onlyGREEN:Color = 0x00ff00ff

@:value(0x003f00ff)staticinlineread onlyGREEN1:Color = 0x003f00ff

@:value(0x007f00ff)staticinlineread onlyGREEN2:Color = 0x007f00ff

@:value(0x00bf00ff)staticinlineread onlyGREEN3:Color = 0x00bf00ff

@:value(0x0000ffff)staticinlineread onlyBLUE:Color = 0x0000ffff

@:value(0x00003fff)staticinlineread onlyBLUE1:Color = 0x00003fff

@:value(0x00007fff)staticinlineread onlyBLUE2:Color = 0x00007fff

@:value(0x0000bfff)staticinlineread onlyBLUE3:Color = 0x0000bfff

@:value(0x00ffffff)staticinlineread onlyCYAN:Color = 0x00ffffff

@:value(0xff00ffff)staticinlineread onlyMAGENTA:Color = 0xff00ffff

@:value(0xffff00ff)staticinlineread onlyYELLOW:Color = 0xffff00ff

@:value(0xffd700ff)staticinlineread onlyGOLD:Color = 0xffd700ff

@:value(0xffa500ff)staticinlineread onlyORANGE:Color = 0xffa500ff

@:value(0x8B4513ff)staticinlineread onlyBROWN:Color = 0x8B4513ff

@:value(0x800080ff)staticinlineread onlyPURPLE:Color = 0x800080ff

@:value(0xffc0cbff)staticinlineread onlyPINK:Color = 0xffc0cbff

@:value(0xccff00ff)staticinlineread onlyLIME:Color = 0xccff00ff

@:value(["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"])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 Strings.

@:value(["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])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 Strings.

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

@:value({ alpha : 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)

@:value({ alpha : 1.0 })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.

@:tostaticinlinetoString(this:Int):String