Tag

oklch

4 articles on oklch.

OKLCH, and why it is worth switching

OKLCH is OKLab in cylindrical form: perceptual lightness, chroma as an absolute distance from gray, and hue as an angle. Its useful property is uniformity — equal numeric steps look like equal steps, and changing hue at fixed L and C does not change how light the color appears. HSL gets both of those wrong, which is why an HSL ramp bunches up at the dark end and why HSL yellow at 50% lightness looks nothing like HSL blue at 50% lightness.

Chroma being absolute rather than a percentage is the part that trips people up first, and it is also the point. The maximum chroma available depends on lightness and hue — sRGB simply holds more saturated yellow than saturated blue — so an honest space cannot express saturation as "100%". Ask for more than the gamut has and something must give.

It is a CSS feature now, not a future one: oklch() ships in every current browser, and @supports covers the rest. Generated ramps, hover states, and accessible palettes all get easier when the space you compute in matches the space the eye reports.

All 4 articles

Tools for oklch