Colour systems

HSL's lightness axis lies. OKLCH fixes it.

HSL lies. Yellow at hsl(60, 100%, 50%) and blue at hsl(240, 100%, 50%) share the same L value, but yellow looks twice as bright. Add a second hue and you're hand-tuning the entire scale again.

OKLCH: perceptually uniform colour

Building a palette with CSS variables

Chroma tapers at extremes because light and dark shades clip at high chroma. To add a second hue, change only the hue angle and chroma curve. Lightness stays the same.

Avoiding pure black and pure white

#000 on #FFF is 21:1 contrast, but harsh. Pure black on pure white creates a vibrating edge.

~18:1 contrast. Far above WCAG AA, far more comfortable.

Dark mode mapping

Dark mode is not a reversed light palette:

Common mistakes