Color (alpha included) stored as integer. Can be decomposed to Color/Int (RGB) + Float (A) and constructed from Color/Int (RGB) + Float (A).

Static variables

@:value(-1)staticinlineread onlyNONE:AlphaColor = -1

@:value(0x00000000)staticinlineread onlyTRANSPARENT:AlphaColor = 0x00000000

@:value(0xFFFFFFFF)staticinlineread onlyWHITE:AlphaColor = 0xFFFFFFFF

@:value(0xFF808080)staticinlineread onlyGRAY:AlphaColor = 0xFF808080

@:value(0xFF000000)staticinlineread onlyBLACK:AlphaColor = 0xFF000000

@:value(0xFF008000)staticinlineread onlyGREEN:AlphaColor = 0xFF008000

@:value(0xFF00FF00)staticinlineread onlyLIME:AlphaColor = 0xFF00FF00

@:value(0xFFFFFF00)staticinlineread onlyYELLOW:AlphaColor = 0xFFFFFF00

@:value(0xFFFFA500)staticinlineread onlyORANGE:AlphaColor = 0xFFFFA500

@:value(0xFFFF0000)staticinlineread onlyRED:AlphaColor = 0xFFFF0000

@:value(0xFF800080)staticinlineread onlyPURPLE:AlphaColor = 0xFF800080

@:value(0xFF0000FF)staticinlineread onlyBLUE:AlphaColor = 0xFF0000FF

@:value(0xFF8B4513)staticinlineread onlyBROWN:AlphaColor = 0xFF8B4513

@:value(0xFFFFC0CB)staticinlineread onlyPINK:AlphaColor = 0xFFFFC0CB

@:value(0xFFFF00FF)staticinlineread onlyMAGENTA:AlphaColor = 0xFFFF00FF

@:value(0xFF00FFFF)staticinlineread onlyCYAN:AlphaColor = 0xFF00FFFF

@:value(0xFF6495ED)staticinlineread onlyCORNFLOWERBLUE:AlphaColor = 0xFF6495ED

@:value(0xFFC71585)staticinlineread onlyMEDIUMVIOLETRED:AlphaColor = 0xFFC71585

@:value(0xFFFF1493)staticinlineread onlyDEEPPINK:AlphaColor = 0xFFFF1493

@:value(0xFFDB7093)staticinlineread onlyPALEVIOLETRED:AlphaColor = 0xFFDB7093

@:value(0xFFFF69B4)staticinlineread onlyHOTPINK:AlphaColor = 0xFFFF69B4

@:value(0xFFFFB6C1)staticinlineread onlyLIGHTPINK:AlphaColor = 0xFFFFB6C1

@:value(0xFF8B0000)staticinlineread onlyDARKRED:AlphaColor = 0xFF8B0000

@:value(0xFFB22222)staticinlineread onlyFIREBRICK:AlphaColor = 0xFFB22222

@:value(0xFFDC143C)staticinlineread onlyCRIMSON:AlphaColor = 0xFFDC143C

@:value(0xFFCD5C5C)staticinlineread onlyINDIANRED:AlphaColor = 0xFFCD5C5C

@:value(0xFFF08080)staticinlineread onlyLIGHTCORAL:AlphaColor = 0xFFF08080

@:value(0xFFFA8072)staticinlineread onlySALMON:AlphaColor = 0xFFFA8072

@:value(0xFFE9967A)staticinlineread onlyDARKSALMON:AlphaColor = 0xFFE9967A

@:value(0xFFFFA07A)staticinlineread onlyLIGHTSALMON:AlphaColor = 0xFFFFA07A

@:value(0xFFFF4500)staticinlineread onlyORANGERED:AlphaColor = 0xFFFF4500

@:value(0xFFFF6347)staticinlineread onlyTOMATO:AlphaColor = 0xFFFF6347

@:value(0xFFFF8C00)staticinlineread onlyDARKORANGE:AlphaColor = 0xFFFF8C00

@:value(0xFFFF7F50)staticinlineread onlyCORAL:AlphaColor = 0xFFFF7F50

@:value(0xFFBDB76B)staticinlineread onlyDARKKHAKI:AlphaColor = 0xFFBDB76B

@:value(0xFFFFD700)staticinlineread onlyGOLD:AlphaColor = 0xFFFFD700

@:value(0xFFF0E68C)staticinlineread onlyKHAKI:AlphaColor = 0xFFF0E68C

@:value(0xFFFFDAB9)staticinlineread onlyPEACHPUFF:AlphaColor = 0xFFFFDAB9

@:value(0xFFEEE8AA)staticinlineread onlyPALEGOLDENROD:AlphaColor = 0xFFEEE8AA

@:value(0xFFFFE4B5)staticinlineread onlyMOCCASIN:AlphaColor = 0xFFFFE4B5

@:value(0xFFFFEFD5)staticinlineread onlyPAPAYAWHIP:AlphaColor = 0xFFFFEFD5

@:value(0xFFFFFACD)staticinlineread onlyLEMONCHIFFON:AlphaColor = 0xFFFFFACD

@:value(0xFFFFFFE0)staticinlineread onlyLIGHTYELLOW:AlphaColor = 0xFFFFFFE0

@:value(0xFFA0522D)staticinlineread onlySIENNA:AlphaColor = 0xFFA0522D

@:value(0xFFD2691E)staticinlineread onlyCHOCOLATE:AlphaColor = 0xFFD2691E

@:value(0xFFCD853F)staticinlineread onlyPERU:AlphaColor = 0xFFCD853F

@:value(0xFFD2B48C)staticinlineread onlyTAN:AlphaColor = 0xFFD2B48C

@:value(0xFF556B2F)staticinlineread onlyDARKOLIVEGREEN:AlphaColor = 0xFF556B2F

@:value(0xFF808000)staticinlineread onlyOLIVE:AlphaColor = 0xFF808000

@:value(0xFF008080)staticinlineread onlyTEAL:AlphaColor = 0xFF008080

@:value(0xFF40E0D0)staticinlineread onlyTURQUOISE:AlphaColor = 0xFF40E0D0

@:value(0xFF000080)staticinlineread onlyNAVY:AlphaColor = 0xFF000080

@:value(0xFF4B0082)staticinlineread onlyINDIGO:AlphaColor = 0xFF4B0082

@:value(0xFFDA70D6)staticinlineread onlyORCHID:AlphaColor = 0xFFDA70D6

@:value(0xFFE6E6FA)staticinlineread onlyLAVENDER:AlphaColor = 0xFFE6E6FA

@:value(0xFFF0FFFF)staticinlineread onlyAZURE:AlphaColor = 0xFFF0FFFF

@:value(0xFFFFFFF0)staticinlineread onlyIVORY:AlphaColor = 0xFFFFFFF0

@:value(0xFF696969)staticinlineread onlyDIMGREY:AlphaColor = 0xFF696969

@:value(0xFF708090)staticinlineread onlySLATEGREY:AlphaColor = 0xFF708090

@:value(0xFFFFFAFA)staticinlineread onlySNOW:AlphaColor = 0xFFFFFAFA

staticred:Int

Red color component as Int between 0 and 255

staticgreen:Int

Green color component as Int between 0 and 255

staticblue:Int

Blue color component as Int between 0 and 255

staticalpha:Int

Alpha component as Int between 0 and 255

staticredFloat:Float

Red color component as Float between 0.0 and 1.0

staticgreenFloat:Float

Green color component as Float between 0.0 and 1.0

staticblueFloat:Float

Blue color component as Float between 0.0 and 1.0

staticalphaFloat:Float

Alpha component as Float between 0.0 and 1.0

staticcyan:Float

staticblack:Float

statichue:Float

The hue of the color in degrees (from 0 to 359)

staticsaturation:Float

The saturation of the color (from 0 to 1)

staticbrightness:Float

The brightness (aka value) of the color (from 0 to 1)

staticlightness:Float

The lightness of the color (from 0 to 1)

staticcolor:Color

RGB color component typed as ceramic.Color

staticrgb:Color

RGB color component typed as ceramic.Color (alias of color)

statichueHSLuv:Float

The HSLuv hue of the color in degrees (from 0 to 359)

staticsaturationHSLuv:Float

The HSLuv saturation of the color (from 0 to 1)

staticlightnessHSLuv:Float

The HSLuv lightness of the color (from 0 to 1)

Static methods

@:tostaticinlinetoColor(this:Int):Color

@:value({ minBrightness : 0.5, minSatutation : 0.5 })staticinlinerandom(minSatutation:Float = 0.5, minBrightness:Float = 0.5):AlphaColor

Generate a random color (away from white or black)

Returns:

The color as an AlphaColor

staticinlinefromInt(value:Int):AlphaColor

Create a color from the least significant four bytes of an Int

Parameters:

value

And Int with bytes in the format 0xAARRGGBB

Returns:

The color as an AlphaColor

staticinlinefromRGB(red:Int, green:Int, blue:Int):AlphaColor

Generate a color from integer RGB values (0 to 255)

Parameters:

red

The red value of the color from 0 to 255

green

The green value of the color from 0 to 255

blue

The green value of the color from 0 to 255

Returns:

The color as a AlphaColor

staticinlinefromRGBFloat(red:Float, green:Float, blue:Float):AlphaColor

Generate a color from float RGB values (0 to 1)

Parameters:

red

The red value of the color from 0 to 1

green

The green value of the color from 0 to 1

blue

The green value of the color from 0 to 1

Returns:

The color as a AlphaColor

staticinlinefromRGBA(red:Int, green:Int, blue:Int, alpha:Int):AlphaColor

Generate a color from integer RGBA values (0 to 255)

Parameters:

red

The red value of the color from 0 to 255

green

The green value of the color from 0 to 255

blue

The green value of the color from 0 to 255

alpha

The alpha value of the color from 0 to 255

Returns:

The color as a AlphaColor

staticinlinefromRGBAFloat(red:Float, green:Float, blue:Float, alpha:Float):AlphaColor

Generate a color from float RGBA values (0 to 1)

Parameters:

red

The red value of the color from 0 to 1

green

The green value of the color from 0 to 1

blue

The green value of the color from 0 to 1

alpha

The green value of the color from 0 to 1

Returns:

The color as a AlphaColor

staticinlinefromCMYK(cyan:Float, magenta:Float, yellow:Float, black:Float):AlphaColor

Generate a color from CMYK values (0 to 1)

Parameters:

cyan

The cyan value of the color from 0 to 1

magenta

The magenta value of the color from 0 to 1

yellow

The yellow value of the color from 0 to 1

black

The black value of the color from 0 to 1

Returns:

The color as a AlphaColor

staticfromHSB(hue:Float, saturation:Float, brightness:Float):AlphaColor

Generate a color from HSB (aka HSV) components.

Parameters:

hue

A number between 0 and 360, indicating position on a color strip or wheel.

saturation

A number between 0 and 1, indicating how colorful or gray the color should be. 0 is gray, 1 is vibrant.

brightness

(aka value) A number between 0 and 1, indicating how bright the color should be. 0 is black, 1 is full bright.

Returns:

The color as a AlphaColor

staticinlinefromHSL(hue:Float, saturation:Float, lightness:Float):AlphaColor

Generate a color from HSL components.

Parameters:

hue

A number between 0 and 360, indicating position on a color strip or wheel.

saturation

A number between 0 and 1, indicating how colorful or gray the color should be. 0 is gray, 1 is vibrant.

lightness

A number between 0 and 1, indicating the lightness of the color

Returns:

The color as a AlphaColor

staticfromString(str:String):Null<AlphaColor>

Parses a String and returns a Color or null if the String couldn't be parsed.

Examples (input -> output in hex):

  • 0xFF00FF00 -> 0xFF00FF00
  • #FF0000FF -> 0xFF0000FF
  • GRAY -> 0xFF808080
  • blue -> 0xFF0000FF

Parameters:

str

The string to be parsed

Returns:

A Color or null if the String couldn't be parsed

staticgetHSBColorWheel():Array<AlphaColor>

Get HSB color wheel values in an array which will be 360 elements in size

Returns:

HSB color wheel as Array of AlphaColors

@:value({ factor : 0.5 })staticinlineinterpolate(color1:AlphaColor, color2:AlphaColor, factor:Float = 0.5):AlphaColor

Get an interpolated color based on two different colors.

Parameters:

color1

The first color

color2

The second color

factor

value from 0 to 1 representing how much to shift color1 toward color2

Returns:

The interpolated color

staticgradient(color1:AlphaColor, color2:AlphaColor, steps:Int, ?ease:Float ‑> Float):Array<AlphaColor>

Create a gradient from one color to another

Parameters:

color1

The color to shift from

color2

The color to shift to

steps

How many colors the gradient should have

ease

An optional easing function, such as those provided in FlxEase

Returns:

An array of colors of length steps, shifting from color1 to color2

@:op(A * B)staticinlinemultiply(lhs:AlphaColor, rhs:AlphaColor):AlphaColor

Multiply the RGB channels of two AlphaColors

@:op(A + B)staticinlineadd(lhs:AlphaColor, rhs:AlphaColor):AlphaColor

Add the RGB channels of two AlphaColors

@:op(A - B)staticinlinesubtract(lhs:AlphaColor, rhs:AlphaColor):AlphaColor

Subtract the RGB channels of one Color from another

@:value({ prefix : true })staticinlinetoHexString(this:Int, prefix:Bool = true):String

Return a String representation of the color in the format

Parameters:

prefix

Whether to include "0x" prefix at start of string

Returns:

A string of length 10 in the format 0xAARRGGBB

staticinlinetoWebString(this:Int):String

Return a String representation of the color in the format #RRGGBB

Returns:

A string of length 7 in the format #RRGGBB

staticgetColorInfo(this:Int):String

Get a string of color information about this color

Returns:

A string containing information about this color

@:value({ factor : 0.2 })staticgetDarkened(this:Int, factor:Float = 0.2):AlphaColor

Get a darkened version of this color

Parameters:

factor

value from 0 to 1 of how much to progress toward black.

Returns:

A darkened version of this color

@:value({ factor : 0.2 })staticinlinegetLightened(this:Int, factor:Float = 0.2):AlphaColor

Get a lightened version of this color

Parameters:

factor

value from 0 to 1 of how much to progress toward white.

Returns:

A lightened version of this color

staticinlinegetInverted(this:Int):Color

Get the inversion of this color

Returns:

The inversion of this color

staticinlinesetRGB(this:Int, red:Int, green:Int, blue:Int):AlphaColor

Set RGB values as integers (0 to 255)

Parameters:

red

The red value of the color from 0 to 255

green

The green value of the color from 0 to 255

blue

The green value of the color from 0 to 255

Returns:

This color

staticinlinesetRGBA(this:Int, red:Int, green:Int, blue:Int, alpha:Int):AlphaColor

Set RGB values as integers (0 to 255)

Parameters:

red

The red value of the color from 0 to 255

green

The green value of the color from 0 to 255

blue

The green value of the color from 0 to 255

alpha

The alpha value of the color from 0 to 255

Returns:

This color

staticinlinesetRGBFloat(this:Int, red:Float, green:Float, blue:Float):AlphaColor

Set RGB values as floats (0 to 1)

Parameters:

red

The red value of the color from 0 to 1

green

The green value of the color from 0 to 1

blue

The green value of the color from 0 to 1

Returns:

This color

staticinlinesetRGBAFloat(this:Int, red:Float, green:Float, blue:Float, alpha:Float):AlphaColor

Set RGB values as floats (0 to 1)

Parameters:

red

The red value of the color from 0 to 1

green

The green value of the color from 0 to 1

blue

The green value of the color from 0 to 1

alpha

The alpha value of the color from 0 to 1

Returns:

This color

staticinlinesetCMYK(this:Int, cyan:Float, magenta:Float, yellow:Float, black:Float):AlphaColor

Set CMYK values as floats (0 to 1)

Parameters:

cyan

The cyan value of the color from 0 to 1

magenta

The magenta value of the color from 0 to 1

yellow

The yellow value of the color from 0 to 1

black

The black value of the color from 0 to 1

Returns:

This color

staticinlinesetHSB(this:Int, hue:Float, saturation:Float, brightness:Float):AlphaColor

Set HSB (aka HSV) components

Parameters:

hue

A number between 0 and 360, indicating position on a color strip or wheel.

saturation

A number between 0 and 1, indicating how colorful or gray the color should be. 0 is gray, 1 is vibrant.

brightness

(aka value) A number between 0 and 1, indicating how bright the color should be. 0 is black, 1 is full bright.

Returns:

This color

staticinlinesetHSL(this:Int, hue:Float, saturation:Float, lightness:Float):AlphaColor

Set HSL components.

Parameters:

hue

A number between 0 and 360, indicating position on a color strip or wheel.

saturation

A number between 0 and 1, indicating how colorful or gray the color should be. 0 is gray, 1 is vibrant.

lightness

A number between 0 and 1, indicating the lightness of the color

Returns:

This color

staticinlinetoString(this:Int):String

Get this RGBA color as String. Format: 0xAARRGGBB

staticinlinefromHSLuv(hue:Float, saturation:Float, lightness:Float):AlphaColor

Generate a color from HSLuv components.

Parameters:

hue

A number between 0 and 360, indicating position on a color strip or wheel.

saturation

A number between 0 and 1, indicating how colorful or gray the color should be. 0 is gray, 1 is vibrant.

lightness

A number between 0 and 1, indicating the lightness of the color

Returns:

The color as a AlphaColor

staticinlinesetHSLuv(this:Int, hue:Float, saturation:Float, lightness:Float):AlphaColor

Set HSLuv components.

Parameters:

hue

A number between 0 and 360, indicating position on a color strip or wheel.

saturation

A number between 0 and 1, indicating how colorful or gray the color should be. 0 is gray, 1 is vibrant.

lightness

A number between 0 and 1, indicating the lightness of the color

Returns:

This color

staticinlinegetHSLuv(this:Int, ?result:Array<Float>):Array<Float>

Get HSLuv components from the color instance.

Parameters:

result

A pre-allocated array to store the result into.

Returns:

The HSLuv components as a float array