Skip to content

Function: mixColors() ​

ts
function mixColors(a, b, t, space?, out?): [number, number, number, number];

Experimental

Mix two sRGB 0–1 colors at t ∈ [0, 1] in space (alpha linearly). Endpoints are exact: t = 0 gives a and t = 1 gives b in every space.

Parameters ​

ParameterTypeDefault value
aRGBAundefined
bRGBAundefined
tnumberundefined
spaceColorscaleInterpolation'rgb'
out[number, number, number, number]...

Returns ​

[number, number, number, number]

Released under the MIT License.