Skip to main content

Function: interpolateColorOklch()

interpolateColorOklch(color1, color2, alpha): string

Defined in: src/utils/oklab.ts:200

Interpolate two colors in Oklch space and return the result as a hex string.

This blends lightness and chroma linearly, and hue along the shortest arc of the color circle. alpha of 0.0 yields color1, 1.0 yields color2. The result tracks a natural hue sweep, so a red-to-green blend stays saturated through orange instead of graying out.

When one endpoint is achromatic (chroma near 0), its hue is undefined, so the hue of the other endpoint is used to avoid an arbitrary sweep.

Parameters​

color1​

string

color2​

string

alpha​

number

Returns​

string