Skip to content

lerpColor

lerpColor(a, b, t): string

Defined in: utils/helpers.ts:200

Linear-RGB interpolation between two CSS colours. t is clamped to [0, 1]. Result is an rgb() string.

Accepts every colour syntax the host browser understands: hex (#rgb, #rrggbb, #rrggbbaa), rgb()/rgba(), named colours (red, salmon), hsl()/hsla(), oklch(), color(), color-mix(), etc. Falls back to black for empty / unrecognised input.

Hot path: heatmap / choropleth fills. The fast hex/rgb paths allocate nothing per call.

Parameters

a

string

b

string

t

number

Returns

string