Color
- 
class 
Color() An object representing an RGB Color. Values are specified in the 0-255 range.
Constructors
Methods
Constructors
- 
Color.constructor(r, g, b) Arguments: - r (
number()) – red color component - g (
number()) – green color component - b (
number()) – blue color component 
Creates a new color object. Values are specified in the 0-255 range.
Return type: Color - r (
 
Methods
assign
equals
fromFloatArray
- 
Color.fromFloatArray(arr) Arguments: - arr (
[number]()) – None 
Sets this color from an array of normalized floating point values
Return type: void - arr (
 
getFloatArray
- 
Color.getFloatArray() Gets an array of floating point values representing this color. Values are clamped in the 0.0 - 1.0 range.
Returns: array of floating point values for this color. Return type: (number, number, number) 
set
- 
Color.set(r, g, b) Arguments: - r (
number()) – red color component - g (
number()) – green color component - b (
number()) – blue color component 
Sets the color object. Values are specified in the 0-255 range.
Return type: void - r (
 
setFromFloat
- 
Color.setFromFloat(r, g, b) Arguments: - r (
number()) – red color component - g (
number()) – green color component - b (
number()) – blue color component 
Sets the color object from floating point values. Values are specified in the 0.0-1.0 range.
Return type: void - r (
 
toFloatArray
- 
Color.toFloatArray(arr) Arguments: - arr (
[number]()) – array whose first three elements will be populated with the r,g, and b values of this color respectively. 
Populates an array with floating point values for this color. Values are clamped in the 0.0 - 1.0 range.
Return type: [number] - arr (
 
toHexString
- 
Color.toHexString() Converts the color to a hexadecimal string.
Returns: Hexadecimal string representation of the color. Return type: string 
toJson
- 
Color.toJson() Creates an object ready for JSON serialization.
Returns: The prepared object. Return type: IColor 
static black
- 
Color.black() Creates a new color object initialized to black.
Returns: new color object Return type: Color 
static blue
- 
Color.blue() Creates a new color object initialized to blue.
Returns: new color object Return type: Color 
static createFromFloat
- 
Color.createFromFloat(r, g, b) Arguments: - r (
number()) – red color component - g (
number()) – green color component - b (
number()) – blue color component 
Creates a color object from floating point values. Values are specified in the 0.0-1.0 range.
Returns: new color object Return type: Color - r (
 
static createFromFloatArray
- 
Color.createFromFloatArray(values) Arguments: - values (
[number]()) – None 
Creates a color object from an array of floating point values. Values are specified in the 0.0-1.0 range.
Return type: Color - values (
 
static fromHexString
- 
Color.fromHexString(hexString) Arguments: - hexString (
string()) – Hexadecimal string representation of the color. 
Creates a color object from a hexadecimal string.
Returns: new color object Return type: Color - hexString (
 
static fromJson
- 
Color.fromJson(objData) Arguments: - objData (
unknown()) – An object given by [[toJson]]. 
Creates a new [[Color]] from an object given by [[toJson]].
Returns: The prepared object. Return type: Color - objData (
 
static green
- 
Color.green() Creates a new color object initialized to green.
Returns: new color object Return type: Color 
static red
- 
Color.red() Creates a new color object initialized to red.
Returns: new color object Return type: Color