
Implement a color. All color components are expected to be in 0.0 - 1.0 range (and not 0-255).
Convert Hex value to Color instance.
Implement a color. All color components are expected to be in 0.0 - 1.0 range (and not 0-255).
Kind: global class
NumberNumberNumberNumberNumberNumberNumberNumberStringNumberNumberColorColorColor\*NumberArray.<String>StringColorColorColorColorColorColorCreate the color.
| Param | Type | Description |
|---|---|---|
| r | Number |
Color red component (value range: 0-1). |
| g | Number |
Color green component (value range: 0-1). |
| b | Number |
Color blue component (value range: 0-1). |
| [a] | Number |
Color alpha component (value range: 0-1). |
NumberGet r component.
Kind: instance property of Color
Returns: Number - Red component.
NumberGet g component.
Kind: instance property of Color
Returns: Number - Green component.
NumberGet b component.
Kind: instance property of Color
Returns: Number - Blue component.
NumberGet a component.
Kind: instance property of Color
Returns: Number - Alpha component.
NumberSet r component.
Kind: instance property of Color
Returns: Number - Red component after change.
NumberSet g component.
Kind: instance property of Color
Returns: Number - Green component after change.
NumberSet b component.
Kind: instance property of Color
Returns: Number - Blue component after change.
NumberSet a component.
Kind: instance property of Color
Returns: Number - Alpha component after change.
StringConvert this color to hex string (starting with ‘#’).
Kind: instance property of Color
Returns: String - Color as hex.
NumberConvert this color to decimal number.
Kind: instance property of Color
Returns: Number - Color as decimal RGBA.
NumberConvert this color to decimal number.
Kind: instance property of Color
Returns: Number - Color as decimal ARGB.
Convert this color to a float array.
Kind: instance property of Color
Get if this color is pure black (ignoring alpha).
Kind: instance property of Color
Get if this color is transparent black.
Kind: instance property of Color
ColorSet the color components.
Kind: instance method of Color
Returns: Color - this.
| Param | Type | Description |
|---|---|---|
| r | Number |
Color red component (value range: 0-1). |
| g | Number |
Color green component (value range: 0-1). |
| b | Number |
Color blue component (value range: 0-1). |
| a | Number |
Color alpha component (value range: 0-1). |
ColorSet the color components from byte values (0-255).
Kind: instance method of Color
Returns: Color - this.
| Param | Type | Description |
|---|---|---|
| r | Number |
Color red component (value range: 0-255). |
| g | Number |
Color green component (value range: 0-255). |
| b | Number |
Color blue component (value range: 0-255). |
| a | Number |
Color alpha component (value range: 0-255). |
ColorCopy all component values from another color.
Kind: instance method of Color
Returns: Color - this.
| Param | Type | Description |
|---|---|---|
| other | Color |
Color to copy values from. |
\*Convert to dictionary.
Kind: instance method of Color
Returns: \* - Dictionary with {r,g,b,a}
| Param | Type | Description |
|---|---|---|
| minimized | Boolean |
If true, will not include keys that their values are 1. You can use fromDict on minimized dicts. |
NumberReturn a clone of this color.
Kind: instance method of Color
Returns: Number - Cloned color.
Convert to string.
Kind: instance method of Color
Check if equal to another color.
Kind: instance method of Color
| Param | Type | Description |
|---|---|---|
| other | Color |
Other color to compare to. |
Array.<String>Get array with all built-in web color names.
Kind: static property of Color
Returns: Array.<String> - Array with color names.
StringConvert a single component to hex value.
Kind: static method of Color
Returns: String - Component as hex value.
| Param | Type | Description |
|---|---|---|
| c | Number |
Value to convert to hex. |
ColorCreate color from hex value.
Kind: static method of Color
Returns: Color - New color value.
| Param | Type | Description |
|---|---|---|
| val | String |
Number value (hex), as #rrggbbaa. |
ColorCreate color from decimal value.
Kind: static method of Color
Returns: Color - New color value.
| Param | Type | Description |
|---|---|---|
| val | Number |
Number value (int). |
| includeAlpha | Number |
If true, will include alpha value. |
ColorCreate color from a dictionary.
Kind: static method of Color
Returns: Color - Newly created color.
| Param | Type | Description |
|---|---|---|
| data | \* |
Dictionary with {r,g,b,a}. |
ColorReturn a random color.
Kind: static method of Color
Returns: Color - Randomized color.
| Param | Type | Description |
|---|---|---|
| includeAlpha | Boolean |
If true, will also randomize alpha. |
ColorBuild and return new color from bytes array.
Kind: static method of Color
Returns: Color - Newly created color.
| Param | Type | Description |
|---|---|---|
| bytes | Array.<Number> |
Bytes array to build color from. |
| [offset] | Number |
Optional offset to read bytes from. |
ColorLerp between two colors.
Kind: static method of Color
Returns: Color - result color.
| Param | Type | Description |
|---|---|---|
| p1 | Color |
First color. |
| p2 | Color |
Second color. |
| a | Number |
Lerp factor (0.0 - 1.0). |
Convert Hex value to Color instance.
Kind: global function
| Param | Type | Description |
|---|---|---|
| hex | String |
Hex value to parse. |