Color systems · Practical guide

OKLCH vs HSL and RGB: why perceptual uniformity matters

In HSL, two colors with the exact same 50% lightness—such as pure yellow and pure blue—have wildly different perceived brightness and WCAG contrast. OKLCH aligns numeric lightness with human vision.

The three axes of oklch(L C H)

  • L (Perceived Lightness, 0% to 100%): Predicts actual visual brightness across hues, making contrast pairing and 50–950 scales repeatable.
  • C (Chroma, ~0 to 0.37): Measures colorfulness independently from lightness so muted neutral bands and vivid accents never drift unexpectedly.
  • H (Hue angle, 0° to 360°): Keeps hue steady when adjusting lightness for accessible hover states or WCAG contrast auto-fixes.

Three places OKLCH immediately improves UI code

  1. Contrast fixing without hue shift: Stepping L up or down while holding C and H preserves brand character when turning a failing button or label into WCAG AA.
  2. Clean mid-tone gradients: Interpolating complementary colors in sRGB often passes through desaturated grey; interpolating in OKLCH keeps saturation vivid.
  3. Cross-hue button balance: Giving success green, warning amber, and primary indigo matching L values prevents one status pill from dominating a table.