Color Science & Engineering

Why Modern Design Systems Are Migrating to the OKLCH Color Space

Learn how Björn Ottosson’s Oklab color model fixes decades of visual distortion in sRGB and HSL, giving UI engineers predictable contrast and vibrant wide-gamut hues.

1. The Fundamental Illusion of HSL Lightness

For over two decades, web designers relied on HSL (Hue, Saturation, Lightness). However, HSL is not perceptually uniform. In HSL, both pure blue (hsl(240, 100%, 50%)) and pure yellow (hsl(60, 100%, 50%)) share the identical lightness value of 50%.

Yet to human biology (governed by the photopic luminosity function $V(\lambda)$), human eyes have dense concentrations of green and red cones. As a result, pure yellow appears blindingly bright (perceived luminance ~93%), while pure blue appears dark and shadowy (perceived luminance ~12%). In HSL, changing hue dramatically warps perceived contrast, causing automated color systems to accidentally generate unreadable UI text.

The Perceptual Contrast Breakdown:

• HSL Yellow (50% L) vs White Text: Contrast 1.07:1 (FAIL - Completely Unreadable)

• HSL Blue (50% L) vs White Text: Contrast 8.60:1 (PASS AAA - Excellent)

• OKLCH (L = 0.50) Across ANY Hue: Constant Perceived Brightness & Contrast

2. Predictable WCAG 2.1 AA/AAA Contrast Math

Developed in 2020 by Björn Ottosson, OKLCH models how the human visual cortex processes light. It separates color into three independent parameters:

  • Lightness (L, 0.0 to 1.0): Strictly corresponds to human perceptual brightness. If token 500 has $L = 0.60$, it looks equally bright whether it is purple, green, orange, or teal.
  • Chroma (C, 0.0 to ~0.37): The purity and colorfulness of the shade. Unlike HSL saturation, chroma is calibrated against actual spectral saturation limits.
  • Hue (H, 0° to 360°): The radial angle representing the color family.

Because lightness is perceptually linear, design systems can establish universal accessibility rules: for example, any background with L ≤ 0.60 is guaranteed to meet WCAG AA contrast (≥ 4.5:1) with pure white text, regardless of hue.

3. Unlocking Display P3 Wide-Gamut Colors

Traditional CSS colors (#hex, rgb(), hsl()) are strictly constrained to the ancient 1996 sRGB color space. However, modern iPhones, iPads, MacBooks, and high-end Android OLED screens cover the Display P3 color space, which contains roughly 50% more visible colors—including radiant neon greens, vivid magenta, and fiery electric oranges.

/* Modern CSS Color 4 Syntax */
--brand-electric: oklch(0.68 0.28 145); /* Vivid P3 green out of sRGB reach */

OKLCH supports the entire visible spectrum. On P3 screens, browsers display the full ultra-vibrant saturation. On standard sRGB monitors, CSS engines perform graceful gamut mapping to the closest achievable tone without color clipping or hue distortion.