Perceptual colour for design systems: why OKLCH beats HSL

In HSL, pure yellow and pure blue both have 50% lightness, yet one is nearly white to the eye and the other nearly navy. OKLCH fixes that, and with it most of the pain of building tonal ramps and accessible palettes.

A physical Munsell colour tree with painted chips arranged by hue, value and chroma around a central grey axis
Photo: Hannes Grobe, CC BY-SA 4.0, via Wikimedia Commons

OKLCH colour describes a colour by perceived lightness (L), chroma (C) and hue (H) in Björn Ottosson's Oklab space, so equal L values look equally light across hues. HSL does not: at "50% lightness" pure yellow measures 96.8 on the OKLCH lightness scale and pure blue 45.2. For a design system, that means OKLCH lets you build tonal ramps that step evenly, swap hues without breaking contrast, and predict text contrast from lightness alone, which is why CSS Color 4 supports oklch() and Tailwind CSS v4 moved its default palette to it in January 2025.

Calculated in this post from Ottosson's published Oklab formulas and the sRGB values of pure yellow (#FFFF00) and pure blue (#0000FF), under WCAG's sRGB linearisation.

Key takeaways
  • At "50% lightness" in HSL, yellow measures 96.8 on the OKLCH lightness scale and blue 45.2.

    Calculated in this post from Ottosson's published Oklab formulas and the sRGB values of pure yellow (#FFFF00) and pure blue (#0000FF), under WCAG's sRGB linearisation.

  • Nine hues with identical HSL lightness span 1.07:1 to 8.59:1 contrast against white.
  • Oklab (Ottosson, December 2020) cut lightness error to 0.20 RMS, against 1.70 for CIELAB.
  • A tone gap of 50 in L* guarantees at least 4.48:1 contrast, whatever the hues.
  • OKLCH is Oklab in polar form: lightness, chroma, hue.
  • CSS Color 4 defines oklch(); Tailwind CSS v4 moved to it in January 2025.

This is for people who build palettes, not pick single colours. If you have ever made a blue ramp and a yellow ramp with the same HSL steps and found that "yellow-500" can never carry white text while "blue-500" can, you have met the problem.

A long-running Graphic Design Stack Exchange question asks how Google's Material palettes were generated; the highly voted answer suggests shifting HSL lightness and saturation. That works for one hue and fails across hues, and the reason is worth understanding properly.

Why does HSL lightness lie?

HSL is a geometric rearrangement of the RGB cube, not a model of vision. Its lightness is the average of the largest and smallest RGB channel, which ignores the fact that the eye is far more sensitive to green than to blue.

The WCAG relative luminance formula shows the imbalance:

So any colour HSL calls "50% lightness, 100% saturation" can have a luminance anywhere from 0.07 (blue) to 0.93 (yellow). I computed the perceived lightness of the fully saturated HSL hues at L = 50%:

Calculated in this post from the WCAG luminance coefficients (0.0722 for pure blue; 0.2126 + 0.7152 for pure yellow, before rounding 0.9278).

Same HSL lightness (50%), very different perceived lightness
See the data as a table
OKLCH lightness (×100)CIELAB L*
Red 0°62.853.2
Orange 30°73.267.1
Yellow 60°96.897.1
Chartreuse 90°89.189.9
Green 120°86.687.7
Spring 150°87.588.5
Cyan 180°90.591.1
Azure 210°61.354.4
Blue 240°45.232.3
Violet 270°52.940.8
Magenta 300°70.260.3
Rose 330°64.554.9

Source: My calculation from the Oklab formulas published by Björn Ottosson and the CIE L* definition, sRGB D65 · Every bar is hsl(hue, 100%, 50%). If HSL lightness matched perception, all bars would be the same height.

CIELAB and OKLCH broadly agree that yellow is very light and blue very dark, which is the point: both model the eye, HSL models the cube. The practical consequences show up in contrast:

hsl(h, 100%, 50%)HexOKLCH LContrast with whiteContrast with black
Red, 0°#FF00000.6284.00:15.25:1
Orange, 30°#FF80000.7322.52:18.34:1
Yellow, 60°#FFFF000.9681.07:119.56:1
Green, 120°#00FF000.8661.37:115.30:1
Cyan, 180°#00FFFF0.9051.25:116.75:1
Azure, 210°#007FFF0.6133.83:15.48:1
Blue, 240°#0000FF0.4528.59:12.44:1
Violet, 270°#7F00FF0.5296.28:13.35:1
Magenta, 300°#FF00FF0.7023.14:16.70:1

Nine colours with identical HSL lightness span contrast ratios with white from 1.07:1 to 8.59:1. Any design token built on HSL steps will need hand correction per hue.

That is the real answer to the Stack Exchange question about hover states, too: the top answer there suggests nudging each hex channel up or down, which shifts hue and saturation along with lightness. In OKLCH you change L by a fixed amount and leave C and H alone.

Several editions of the Munsell Book of Color on a shelf
Editions of the Munsell Book of Color. Munsell organised colour by hue, value (lightness) and chroma more than a century ago; OKLCH is the same idea expressed in equations a browser can run.Photo: Mark Fairchild, CC BY-SA 3.0, via Wikimedia Commons

How did we get from CIELAB to Oklab?

CIELAB (1976) was the first widely used perceptual space: L* for lightness, a* for green-red, b* for blue-yellow. It made lightness far more uniform than RGB, but its hue lines bend, most notoriously in blue, where increasing chroma at a "constant" hue drifts towards purple. Colour scientists spent the next 25 years patching it: CIELAB dates from 1976 and the CIE published CIEDE2000 in 2001 (Sharma, Wu and Dalal, 2005).

The patches show up in colour-difference formulas. CIEDE2000, published by the CIE in 2001, adds corrections for lightness, chroma and hue weighting, plus a special rotation term for the blue region around a hue angle of 275°, exactly where CIELAB is weakest. It is accurate but complicated enough that implementers routinely get it wrong.

The CIEDE2000 Color-Difference Formula: Implementation Notes, Supplementary Test Data, and Mathematical ObservationsGaurav Sharma, Wencheng Wu, Edul N. Dalal · Color Research & Application 30(1) · 2005

The authors (University of Rochester and Xerox) show that the official worked examples for CIEDE2000 miss several common implementation errors, publish 34 supplementary test pairs designed to catch them, and identify small mathematical discontinuities caused by how the formula averages hue angles. One error they flag, ignoring the sign of hue and chroma differences, matters mainly in the blue region around 275°, where the formula's rotation term is largest. The limit: it is an implementation paper, so it checks the formula's maths rather than testing it against new perception data.

Read the paper (free)
The story

On 23 December 2020, Björn Ottosson posted an article on his personal blog. He wanted a simple colour space for everyday image work: turning a photo grey while keeping its perceived lightness, raising saturation without shifting hue, and blending smoothly between two colours. The existing options kept failing him. CIELAB and CIELUV predicted hue badly, especially in blues; CAM16-UCS behaved poorly in calculations and blended badly.

So he built his own, kept it to two matrices and a cube root, and called it Oklab. In a 2025 update to the same post he wrote that he never expected it to spread so far: it had become Photoshop's default gradient interpolation, part of CSS Color 4 and 5 in the major browsers, Unity's gradient mode and Godot's colour picker, all within a few years of a blog post.

Björn Ottosson: A perceptual color space for image processing (2020, 2025 note)

Oklab, published by Björn Ottosson in December 2020, takes a different route. Instead of patching CIELAB, it keeps the very simple structure of the IPT colour space (a matrix, a cube root, another matrix) and fits the matrices so that lightness and chroma match the modern CAM16 appearance model and hue matches perceptual hue data. The result is nearly as uniform as heavy appearance models but as cheap to compute as CIELAB, with a clean inverse.

A perceptual color space for image processing (Oklab)Björn Ottosson · Technical article (not peer reviewed) · 2020, updated 2025

Ottosson fitted Oklab to three datasets: colour pairs generated with CAM16 to have equal lightness, pairs with equal chroma, and the Ebner-Fairchild uniform-hue data behind IPT, measuring errors with CIEDE2000. Oklab's lightness error was 0.20 RMS against 1.70 for CIELAB and 11.59 for HSV; chroma 0.81 against 1.84; hue 0.49 against 0.69. The fitted exponent came out at 0.323 and was fixed to 1/3. By 2025 Oklab had been adopted in CSS Color 4 and 5, Photoshop's default gradient interpolation, Unity and Godot. The limit, as the author notes: the lightness and chroma data are generated from CAM16, not fresh human experiments, so these errors measure agreement with a model.

Read the article (free)
Colour spaceLightness error (RMS)Chroma error (RMS)Hue error (RMS)Note
Oklab0.200.810.49Simple, invertible, used by CSS oklch()
CIELAB1.701.840.69Blue hue drifts toward purple
CIELUV1.722.320.68Similar weaknesses to CIELAB
IPT4.922.180.48Excellent hue, poor lightness
JzAzBz2.381.790.43Built for HDR; depends on absolute luminance
HSV11.593.381.10Not a perceptual space at all

Errors are from Ottosson's comparison; CAM16-UCS scores zero on lightness and chroma by construction because it generated that test data.

How does OKLCH relate to Oklab?

OKLCH is Oklab in polar form. L stays the same; a and b become chroma (distance from grey, C = √(a² + b²)) and hue (the angle, H = atan2(b, a)). It is the same relationship as between CIELAB and CIE LCh, and it maps directly to how designers think: how light, how colourful, which colour.

The conversion from sRGB is short enough to read:

sRGB valuee.g. #2E5BFF 1. Lineariseundo the sRGB transfer curve 2. Matrix to LMScone-like responses l, m, s 3. Cube rootthe perceptual step 4. Matrix to L, a, bthis is Oklab 5. Polar: OKLCHC = √(a² + b²), H = atan2(b, a)
From hex to OKLCH in five steps: two matrices around a cube root, then a polar conversion. The browser does all of this when you write oklch().
  1. Linearise sRGB with the standard transfer function.
  2. Convert to a cone-like LMS response with a 3×3 matrix (for linear sRGB the first row is 0.4122, 0.5363, 0.0514).
  3. Take the cube root of each of l, m and s, the step that makes the space roughly perceptual.
  4. Mix into L, a, b with a second matrix; L = 0.2105 l′ + 0.7936 m′ − 0.0041 s′.

    Matrix values as published in Ottosson's Oklab article; rounded here to four decimals.

  5. Go polar for C and H.

In CSS you write oklch(0.62 0.19 259) and the browser does the rest.

CSS Color Module Level 4, a W3C Candidate Recommendation Draft dated 12 November 2026, defines oklch() and requires out-of-gamut colours to be gamut-mapped by reducing chroma, so a colour you specify beyond sRGB or Display P3 is shown as the nearest less saturated version rather than being clipped into a different hue.

How do you build an even tonal ramp in OKLCH?

Fix the hue, step L in equal increments, and set chroma per step to the highest value that stays in gamut, tapering towards white and black. Equal L steps look like equal steps, so "500" means the same visual weight in every hue.

  1. Choose your L scale once for all hues. For an 11-step ramp, L values such as 0.97, 0.93, 0.87, 0.80, 0.71, 0.62, 0.54, 0.46, 0.38, 0.30, 0.22 give dense steps near white, where the eye is sensitive.
  2. Set hue per family. For example 259 for blue, 145 for green, 29 for red.
  3. Find maximum chroma per step. The sRGB gamut is narrow at very high and very low L, and different per hue: yellow reaches high chroma only at high L, blue only at low L. Clamp chroma to what fits.
  4. Adjust hue slightly at the ends if needed. Real pigments and good palettes often warm their light tints and cool their shadows; do it deliberately, not by accident.
  5. Check contrast between steps, using the table in the next section.
Same steps, different meaning HSL, lightness 30-90% OKLCH, L 0.40-0.95 Top: at the same HSL step, yellow is always far lighter than blue, so "step 3" means different things in each family. Bottom: equal OKLCH L gives equal visual weight; chroma is tapered to stay in gamut.
HSL ramps against OKLCH ramps. Browsers that support oklch() in SVG render the bottom rows exactly; the values are illustrative, chosen to stay inside sRGB.

Can lightness alone predict accessible contrast?

Close to it, and this is the best practical reason to use a perceptual space. WCAG 2 contrast depends only on luminance, and luminance is a fixed function of CIELAB L*, so a minimum gap in L* guarantees a minimum contrast ratio whatever the hues. I worked out the guarantees: a gap of 40 in L* always gives at least 3.17:1, and a gap of 50 gives at least 4.48:1, effectively the 4.5:1 body-text threshold.

Gap in L* (tone)Worst-case WCAG 2 contrastBest-case contrastGood for
302.25:12.97:1Decorative borders only
403.17:14.16:1Large text, UI components (3:1)
504.48:15.73:1Body text (4.5:1), just
606.46:17.74:1Comfortable body text, near AAA

Google's HCT does the same thing

This is the idea behind Google's HCT colour system in Material Design 3. HCT takes hue and chroma from the CAM16 appearance model and tone from CIELAB L*; Google's material-color-utilities documentation gives the example of #FF6600 orange as hue 42.4, chroma 79.4, tone 62.3.

When an HCT colour cannot be shown in sRGB, the library keeps the tone and reduces chroma, so contrast guarantees survive gamut mapping.

OKLCH's L is close enough to L* for ramps, and you can always verify the final pair with the WCAG formula or the APCA method in colour contrast beyond WCAG 2.

Contrast from tone (CIELAB L*) alone

What does colourfulness mean in OKLCH?

Chroma is OKLCH's measure of colourfulness relative to a grey of the same lightness. It answers the Stack Exchange question about whether colourfulness can be measured: yes, as C, and unlike HSL saturation it does not reach 100% for every hue at every lightness.

HSL saturation of 100% just means one channel is at zero; it says nothing about how vivid the colour looks. In OKLCH, sRGB's most saturated blue has a chroma around 0.31 while its most saturated yellow sits near 0.21, and both only at their own lightness.

HSL saturation of 100% just means one channel is at zero; it says nothing about how vivid the colour looks.

That asymmetry is real (it comes from the display primaries and from vision), and seeing it in numbers stops you asking a palette to do something the screen cannot. Wide-gamut displays extend the reach: Tailwind v4's OKLCH palette was designed to be more vivid on Display P3 screens while keeping the same balance as v3 on sRGB.

Illustration from Albert Munsell's A Color Notation showing the colour tree enclosing a colour sphere
A plate from Albert Munsell's A Color Notation: the colour tree inside a sphere. Its branches are uneven because some hues reach high chroma only at certain lightness levels, the same gamut shape OKLCH exposes.Photo: Albert Henry Munsell (1858—1918), Public domain, via Wikimedia Commons

How do you move an existing design system to OKLCH?

Convert, measure, then rebuild the ramps, in that order. A direct conversion of HSL tokens to oklch() changes nothing visually; the gain comes from re-spacing the L values.

  1. Convert every token to OKLCH and list its L, C and H.
  2. Plot L per step across families. You will usually see yellows and greens far lighter than blues and purples at the same step number.
  3. Define one L scale for all families and re-set each token's L to it, keeping H, then reduce C where the colour leaves the gamut.
  4. Re-check brand colours separately. A brand red such as #E0283A or a cobalt such as #2E5BFF should keep its exact value as an anchor; build the ramp around it rather than forcing it onto the grid.
  5. Write contrast rules as tone gaps. For example, "text on surface needs a gap of 50 or more", and test with the calculator above.
  6. Ship with fallbacks if you support old browsers: an sRGB hex fallback before the oklch() declaration.

Print is the one place OKLCH does not help directly, because ink colour is defined in CMYK or spot systems; see RGB vs CMYK for print. And for how Indian brands actually use colour in their identities, see brand colours of top Indian brands. My own identity work, where these palettes get used, is on the work page.

Twenty Munsell hues arranged in a circle, each at its maximum chroma
Twenty Munsell hues at maximum chroma. Even here, the strongest yellow and the strongest blue differ hugely in lightness, which is why a ramp has to be built per hue on one shared lightness scale.Photo: 8-leaf clover, CC BY-SA 4.0, via Wikimedia Commons

Questions people ask

How do I generate a palette like Material Design's?

Material Design 3 uses HCT: CAM16 hue and chroma with CIELAB tone. Pick a source colour, keep its hue, and generate tones at fixed L* values (such as 10, 20 ... 90, 95, 99), reducing chroma where needed. OKLCH with fixed L steps gives a very similar result with standard CSS.

How do I make a hover shade that looks consistent across colours?

In OKLCH, lower L by a fixed amount (around 0.05-0.08) and keep C and H. Unlike adding or subtracting from each hex channel, this changes only lightness, and the step looks the same on blue, yellow and red buttons.

Is there a measurement of colourfulness?

Yes. OKLCH chroma (C) measures distance from the grey of the same lightness. It is a more honest number than HSL saturation, which is 100% for every pure hue regardless of how vivid it looks.

Is OKLCH better than CIELAB for design?

For UI work, usually. It keeps CIELAB's predictable lightness but fixes the blue hue shift, and browsers support it natively. For print and industrial colour tolerance, CIELAB with CIEDE2000 remains the standard.

Sources

  1. Björn Ottosson: A perceptual color space for image processing (Oklab) (2020, updated 2025)
  2. Sharma, Wu, Dalal: The CIEDE2000 Color-Difference Formula, Color Research & Application (2005)
  3. W3C: CSS Color Module Level 4 (Candidate Recommendation Draft, 12 Nov 2026)
  4. Tailwind Labs: Tailwind CSS v4.0 (22 Jan 2025)
  5. Google: material-color-utilities, colour spaces and HCT
  6. Google Material Design 3: Colour system
  7. W3C: WCAG 2.2, relative luminance and contrast ratio (2024 edition)
  8. CIE: International Commission on Illumination
  9. Graphic Design Stack Exchange: Generating a palette like Material Design's
  10. Graphic Design Stack Exchange: Lighter or darker shade for a hover state
  11. Graphic Design Stack Exchange: Is there a measurement of colourfulness?
oklch colourOklabHSLCIELABCIEDE2000Material HCTTailwind CSS v4CSS Color 4
Sapta

Sapta (Saptarshi Sarkar) is a mechanical engineer turned marketer in Bengaluru and a solo touring rider. He writes the seven Saptaverse blogs. Work with him or read more of Artblog.

Keep reading in Artblog

From the other blogs