Creates a new Color instance.
Optionalr: numberThe r value. Defaults to 0.
Optionalg: numberThe g value. Defaults to 0.
Optionalb: numberThe b value. Defaults to 0.
Optionala: numberThe a value. Defaults to 1.
Creates a new Color instance.
The array to set the color values from.
The alpha component of the color.
The blue component of the color.
The green component of the color.
The red component of the color.
Static ReadonlyBLACKA constant color set to black [0, 0, 0, 1].
Static ReadonlyBLUEA constant color set to blue [0, 0, 1, 1].
Static ReadonlyCYANA constant color set to cyan [0, 1, 1, 1].
Static ReadonlyGRAYA constant color set to gray [0.5, 0.5, 0.5, 1].
Static ReadonlyGREENA constant color set to green [0, 1, 0, 1].
Static ReadonlyMAGENTAA constant color set to magenta [1, 0, 1, 1].
Static ReadonlyREDA constant color set to red [1, 0, 0, 1].
Static ReadonlyWHITEA constant color set to white [1, 1, 1, 1].
Static ReadonlyYELLOWA constant color set to yellow [1, 1, 0, 1].
Reports whether two colors are equal.
The color to compare to the specified color.
True if the colors are equal and false otherwise.
Set the values of the vector from an array.
The array to set the vector values from.
Optionaloffset: number = 0The zero-based index at which to start copying elements from the array. Default is 0.
Self for chaining.
Set the values of the color from a string representation '#11223344' or '#112233'.
A string representation in the format '#RRGGBBAA' or '#RRGGBB'. Where RR, GG, BB, AA are red, green, blue and alpha values. This is the same format used in HTML/CSS.
Self for chaining.
Returns the result of a linear interpolation between two specified colors.
The color to interpolate from.
The color to interpolate to.
The value controlling the point of interpolation. Between 0 and 1, the linear interpolant will occur on a straight line between lhs and rhs. Outside of this range, the linear interpolant will occur on a ray extrapolated from this line.
Self for chaining.
Multiplies RGB elements of a Color by a number. Note that the alpha value is left unchanged.
The number to multiply by.
Self for chaining.
Assign values to the color components, including alpha.
The value for red (0-1).
The value for blue (0-1).
The value for green (0-1).
Optionala: number = 1The value for the alpha (0-1), defaults to 1.
Self for chaining.
Optionalarr: number[]The array to populate with the color's number components. If not specified, a new array is created.
Optionaloffset: numberThe zero-based index at which to start copying elements to the array. Default is 0.
The color as an array.
The array to populate with the color's number components. If not specified, a new array is created.
Optionaloffset: numberThe zero-based index at which to start copying elements to the array. Default is 0.
The color as an array.
Converts the color to string form. The format is '#RRGGBBAA', where RR, GG, BB, AA are the red, green, blue and alpha values. When the alpha value is not included (the default), this is the same format as used in HTML/CSS.
If true, the output string will include the alpha value.
OptionalasArray: booleanIf true, the output will be an array of numbers. Defaults to false.
The color in string form.
An RGBA color.
Each color component is a floating point value in the range 0 to 1. The r (red), g (green) and b (blue) components define a color in RGB color space. The a (alpha) component defines transparency. An alpha of 1 is fully opaque. An alpha of 0 is fully transparent.