[ view source ]
abstract AlphaColor(Int)
package ceramic
from Int, UInt to Int, UInt,
Available on all targets
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
Static methods
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>
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
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
staticinlinemultiply(lhs:AlphaColor, rhs:AlphaColor):AlphaColor
Multiply the RGB channels of two AlphaColors
staticinlinesubtract(lhs:AlphaColor, rhs:AlphaColor):AlphaColor
Subtract the RGB channels of one Color from another
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
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
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
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