The numeric value of the blue channel between [0, 1].
A CSS-compatible color string. If this color is not valid, the empty string is returned. An alias for Color#toString.
The numeric value of the green channel between [0, 1].
The color represented as an HSL array. Assumes r, g, and b are contained in the set [0, 1] and returns h, s, and l in the set [0, 1].
The color represented as an HSV array. Conversion formula adapted from http://en.wikipedia.org/wiki/HSV_color_space. Assumes r, g, and b are contained in the set [0, 1] and returns h, s, and v in the set [0, 1].
The color represented as a linear RGB array. Assumes r, g, and b are contained in the set [0, 1] and returns linear r, g, and b in the set [0, 1].
Get the value of this color in little endian format.
The maximum value of all channels.
The minimum value of all channels.
The numeric value of the red channel between [0, 1].
The color represented as an RGB array.
Is this a valid color?
Iterating over a Color is equivalent to iterating over its [r,g,b] color channels.
Set an rgb array with the rgb values contained in this Color class.
Receive the result. Must be an array with at least a length of 3.
Test whether this color equals some other color
Some other color or hex number
Are the colors equal?
Returns the color as a CSS string.
The color as a CSS string
Serialize the Color.
The color as a CSS string
Get a CSS-compatible RGBA color string.
The desired alpha in the range [0, 1]
A CSS-compatible RGBA string
Static
addAdd two colors.
The first color.
The second color.
The resulting color as a number.
Static
addAdd a static scalar to a color.
The color.
Scalar to add with (normalized).
The resulting color as a number.
Static
applyRGBConvert a color to RGB and assign values to a passed array.
The color to convert to RGB values.
Receive the result. Must be an array with at least a length of 3.
Static
fromCreate a Color instance from an RGB array.
A color input
The hex color instance or NaN
Static
fromHSLCreate a Color instance from an HSL array. Assumes h, s, and l are contained in the set [0, 1].
An HSL tuple
The hex color instance
Static
fromHSVCreate a Color instance from an HSV array. Conversion formula adapted from http://en.wikipedia.org/wiki/HSV_color_space. Assumes h, s, and v are contained in the set [0, 1].
An HSV tuple
The hex color instance
Static
fromCreate a Color instance (sRGB) from a linear rgb array. Assumes r, g, and b are contained in the set [0, 1].
The linear rgb array
The hex color instance
Static
fromRGBCreate a Color instance from an RGB array.
An RGB tuple
The hex color instance
Static
fromRGBvaluesCreate a Color instance from an RGB normalized values.
The red value
The green value
The blue value
The hex color instance
Static
fromCreate a Color instance from a color string which either includes or does not include a leading #.
A color string
The hex color instance
Static
maximizeMaximize two colors.
The first color.
The second color.
The result.
Static
maximizeMaximize a color by a static scalar.
The color to maximize.
Scalar to maximize with (normalized).
The resulting color as a number.
Static
minimizeMinimize two colors.
The first color.
The second color.
Static
minimizeMinimize a color by a static scalar.
The color.
Scalar to minimize with (normalized).
Static
mixApply a linear interpolation between two colors, according to the weight.
The first color to mix.
The second color to mix.
Weight of the linear interpolation.
The resulting mixed color
Static
multiplyMultiply two colors.
The first color to multiply.
The second color to multiply.
The result.
Static
multiplyMultiply a color by a scalar
The color to multiply.
A static scalar to multiply with.
The resulting color as a number.
Static
subtractSubtract two colors.
The first color.
The second color.
Static
subtractSubtract a color by a static scalar.
The color.
Scalar to subtract with (normalized).
The resulting color as a number.
A representation of a color in hexadecimal format. This class provides methods for transformations and manipulations of colors.