Skip to main content

Constructors

lerp

Linearly interpolates between two colors using the parameter t, where t = 0 returns ‘from’ and t = 1 returns ‘to’.

rgb

Returns a color constructed from red, green, and blue channels. Alpha defaults to 255 (fully opaque). Channel values are clamped to [0, 255].

rgba

Returns a color constructed from red, green, blue, and alpha channels. Channel values are clamped to [0, 255].

Static Functions

red

Returns the red, green, or blue channel of the color. If a value is provided, returns a new color with that channel updated.

green

blue

alpha

Returns the alpha channel of the color, or returns a new color with the alpha channel set to the specified value. Values are clamped to [0, 255].

opacity

Returns the opacity of the color as a normalized value in the range [0.0, 1.0], or returns a new color with its alpha set from the specified opacity.