Create a color from red (0-255), green (0-255), blue (0-255) and alpha (0-1) channels.
The red value of the color (0-255).
The green value of the color (0-255).
The blue value of the color (0-255).
The alpha value of the color (0-1).
A double for the alpha value (0-1).
An unsigned byte value (0-255) representing the blue channel value.
An unsigned byte value (0-255) representing the green channel value.
An unsigned byte value (0-255) representing the red channel value.
An rgb or rbga string representation of the color.
Creates a Color instance given an object with r
, g
, b
and an optional a
attribute.
An object from which to create a Color instance.
A Color instance.
// Create a color from an rgb object.
const color1 = Color.fromObject( { r: 1, g: 2, b: 3 } );
// Clone the first color and change the 'g' value to 20.
const color2 = Color.fromObject( { ...color, g: 20 } );
RGBA representation of a color. Color instances are returned by Properties.get when you retrieve the value of a color property. Palette functions also return Color instances.