Constructors
Properties
Methods
Constructors
constructor
-
Creates a new color object. Values are specified in the 0-255 range.
Parameters
-
r: number
red color component
-
g: number
green color component
-
b: number
blue color component
Returns Color
-
Properties
b
g
r
Methods
assign
copy
-
Creates a copy of this color
Returns Color
Copy of this color
equals
-
Compares this color with another color
Parameters
-
color: Color
the color to compare with
Returns boolean
True if the values of this color equal the other. False otherwise.
-
forJson
[deprecated]
-
Returns Object
fromFloatArray
-
Sets this color from an array of normalized floating point values
Parameters
-
arr: number[]
Returns void
-
getFloatArray
-
Gets an array of floating point values representing this color. Values are clamped in the 0.0 - 1.0 range.
Returns [number, number, number]
array of floating point values for this color.
set
-
Sets the color object. Values are specified in the 0-255 range.
Parameters
-
r: number
red color component
-
g: number
green color component
-
b: number
blue color component
Returns void
-
setFromFloat
-
Sets the color object from floating point values. Values are specified in the 0.0-1.0 range.
Parameters
-
r: number
red color component
-
g: number
green color component
-
b: number
blue color component
Returns void
-
toFloatArray
-
Populates an array with floating point values for this color. Values are clamped in the 0.0 - 1.0 range.
Parameters
-
arr: number[]
array whose first three elements will be populated with the r,g, and b values of this color respectively.
Returns void
-
toJson
-
Creates an object ready for JSON serialization.
Returns Object
The prepared object.
Static black
-
Creates a new color object initialized to black.
Returns Color
new color object
Static blue
-
Creates a new color object initialized to blue.
Returns Color
new color object
Static createFromFloat
-
Creates a color object from floating point values. Values are specified in the 0.0-1.0 range.
Parameters
-
r: number
red color component
-
g: number
green color component
-
b: number
blue color component
Returns Color
new color object
-
Static createFromFloatArray
-
Creates a color object from an array of floating point values. Values are specified in the 0.0-1.0 range.
Parameters
-
values: number[]
Returns Color
-
Static fromJson
Static green
-
Creates a new color object initialized to green.
Returns Color
new color object
Static red
-
Creates a new color object initialized to red.
Returns Color
new color object
Static white
-
Creates a new color object initialized to white.
Returns Color
new color object
Static yellow
-
Creates a new color object initialized to yellow.
Returns Color
new color object
An object representing an RGB Color. Values are specified in the 0-255 range.