Palg

OKLCH explained

By Theo Lane (pen name; AI-assisted, hand-checked) ·

OKLCH is a way of describing colors by lightness, chroma and hue that lines up closely with how people perceive them. It is now supported in every major browser through the CSS oklch() function, and it quietly powers most of what Palg does. This guide explains what it is and when to reach for it.

From RGB to perceptual spaces

Screens mix red, green and blue light, so RGB is the native language of displays. But RGB numbers are not intuitive: it is hard to look at rgb(64, 128, 191) and know how to make it “a bit lighter but just as blue”. HSL and HSV were invented in the 1970s to give RGB a friendlier shape — hue, saturation, lightness — but they keep RGB’s non-uniformity. Change HSL hue while holding lightness fixed and the perceived brightness jumps around wildly.

Perceptual spaces are built from experiments on human vision. CIELAB (1976) and its cylindrical form LCh were the standard for decades. Lab has known flaws, notably that blues drift toward purple when you change lightness or chroma. In 2020 Björn Ottosson published OKLab, a simple space fitted to modern color-appearance data that fixes most of those issues while staying cheap to compute. OKLCH is OKLab in polar form: L for lightness, C for chroma, h for hue angle.

Reading an OKLCH value

In CSS, oklch(62% 0.19 264) means:

Note that the hue angles differ from HSL. OKLCH red is near 29°, not 0°. Palg’s color pages show both, so you can get a feel for the mapping.

Why it makes better palettes

Because L tracks perceived lightness, two colors with the same L really do look equally light. That has practical consequences:

The gamut catch

OKLCH can describe colors that your screen cannot show. A vivid yellow at L 50% simply does not exist in sRGB. When a requested color is out of gamut, something has to give. Browsers apply CSS Color 4 gamut mapping; Palg reduces chroma step by step (a binary search) while keeping L and h fixed, until the color fits sRGB. This keeps your intent — lightness and hue — and gives up some vividness, which is almost always the right trade.

Wide-gamut displays (Display P3) can show more chroma. If you write oklch() in CSS, P3 screens can render the extra intensity while sRGB screens fall back automatically. Palg exports HEX values, which are sRGB, so what you see is what everyone sees.

Writing OKLCH in CSS

:root {
  --brand: oklch(55% 0.2 264);
  --brand-hover: oklch(from var(--brand) calc(l - 0.07) c h);
}
.button { background: var(--brand); }
.button:hover { background: var(--brand-hover); }

The relative color syntax (oklch(from …)) lets you derive hover, pressed and disabled states from one token, adjusting only lightness. Support is now broad in evergreen browsers; for older ones, keep a HEX fallback above the modern declaration.

When not to use OKLCH

For print, you will ultimately need CMYK values from your printer’s profile — no screen space helps there (see print vs screen). For pixel-exact brand matching you will keep the HEX or Pantone reference you were given. And if your team’s tools do not yet understand oklch(), generate in OKLCH and export HEX, which is what Palg does by default.

Try it

Switch the generator’s display to OKLCH and press Space a few times. Watch the L values: Palg spreads them across the palette so you always get a usable light-to-dark range. Then lock a color and switch harmony modes — the hue angle changes while lightness stays sensible.

More guides