If you bump the lightness of two HSL colors by the same amount, one often looks far brighter than the other. And that’s a problem. HSL and HEX were built around how screens mix light, not necessarily how people see color. OKLCH was built around perception, and that changes how you make palettes, gradients and accessible UI.
What is OKLCH? (The short answer)
OKLCH is a perceptually uniform color model that describes a color with three values: Lightness (L), Chroma (C), and Hue (H). Unlike HSL, equal steps in OKLCH lightness look like equal steps in brightness across hues. It is supported in current browsers through the CSS oklch() function, and it can describe colors beyond sRGB, including the full Display P3 range.
That one property, perceptual uniformity, is why teams are moving design tokens to OKLCH.
The problem with HSL and HEX
HSL looks intuitive, but its “lightness” is more of a mathematical product, not a perceptual measurement. For example, both of these claim 50% lightness:
- HSL (60 100% 50%) is a yellow that glows.
- HSL (240 100% 50%) is a blue that looks dark by comparison.
This can cause real problems in a design:
- Inconsistent scales. A “500” in your blue ramp and a “500” in your yellow ramp don’t feel equivalent.
- Unpredictable contrast. Text contrast can shift unevenly across hues, so you end up testing every pair by hand.
- Muddy gradients. When blending two saturated colors in sRGB, you often can see how they pass through a dull, gray midpoint.
- Color ceiling. HEX and HSL can’t express colors outside sRGB, though many phones, tablets and laptops can display them.
| HSL | OKLCH | |
| Lightness matches perception | No, varies by hue | Yes, by design |
| Shade scales | Needs per-hue tweaking | Change L, keep hue and chroma |
| Gradients | Can pass through gray | Smoother |
| Wide gamut (Display P3) | Not directly | Yes |
| CSS syntax | hsl(220 90% 50%) | oklch(0.62 0.19 260) |
How to read an OKLCH Color value
You will usually encounter OKLCH in two places: inside your CSS stylesheets, or in the color inspection panels of design tools like Prismii, Figma, and browser dev tools.
In CSS, an OKLCH value is written like this:
color: oklch(0.62 0.19 260);
The three numbers inside the parentheses control Lightness, Chroma, and Hue in order:
• L (Lightness, 0 to 1): Perceived brightness. 0 is pure black, 1 is pure white. A value of 0.62 gives you a medium-bright shade.
• C (Chroma, 0 to about 0.4): Color intensity and vividness. 0 is a neutral gray. A value even just as high as 0.19 will create a rich, saturated color without clipping.
• H (Hue, 0° to 360°): The angle on the color wheel. 260° lands in the blue family (reds sit around 20°, greens around 140°).
To add transparency, append a slash and an alpha value at the end, like this: oklch(0.62 0.19 260 / 0.5).
OKLCH vs Display P3: not rivals
People often search these two terms side by side, but they answer different questions.
- OKLCH is a color model: a way of writing down a color.
- Display P3 is a gamut: the range of colors a screen can show.
You can write an sRGB color, a Display P3 color or something beyond both in OKLCH. Picking in OKLCH is a practical way to work in P3 because lightness stays predictable while you push chroma. For the visual side of that story, see our guide to Display P3 vs sRGB
Build a shade scale that’s predictable
When you design a UI design system, you usually need a multi-step color ramp—from soft background tints (like a `100` step) to deep text colors (like a `900` step).
In traditional HSL, building these scales means constantly tweaking individual values by hand because hue shifts as lightness changes.
In OKLCH, the process becomes systematic: hold your hue angle steady, step your lightness down evenly, and taper your chroma slightly at the very top and bottom so bright highlights and deep shadows stay within display boundaries.
Here is what a 5-step blue scale looks like defined as CSS custom properties:
“`css
:root {
–blue-100: oklch(0.95 0.03 260); /* Lightest tint */
–blue-300: oklch(0.82 0.09 260);
–blue-500: oklch(0.62 0.19 260); /* Base brand blue */
–blue-700: oklch(0.45 0.16 260);
–blue-900: oklch(0.30 0.09 260); /* Deep shade */
}
Notice how the hue angle (260) stays identical across every step, while lightness (0.95 down to 0.30) steps down smoothly.
Because OKLCH lightness is perceptual, a 500 step in your blue ramp and a 500 step in your green ramp carry the exact same visual weight. That consistency makes building themes, dark modes, and interactive component states dramatically easier.
Pro Tip: Building a 48-step scale by hand means a lot of trial and error. Prismii is an OKLCH color picker built around an interactive gamut wheel. It generates shades and tints from any color, checks WCAG contrast live, and exports straight to CSS oklch(). It’s free to start: download it on the App Store.
OKLCH contrast: close, but not the same as WCAG
Because OKLCH lightness tracks perception, a large L difference between two colors usually means good contrast, and that relationship holds far more consistently across hues than in HSL. You can plan a palette where every 700-and-darker shade works on every 100-and-lighter shade.
But remember to be precise: WCAG 2.x contrast ratios are calculated from relative luminance, not OKLCH lightness. OKLCH gets you close and saves time, but you should still verify final pairs against the WCAG contrast requirements (4.5:1 for normal text, 3:1 for large text and UI components). This is why Prismii shows the actual ratio live as you move the sliders.
This is also the honest answer to “balance color accuracy with accessibility,” where we design by perception, then confirm with the standard we are held to.
Fix muddy gradients
If you have ever built a colorful CSS gradient and noticed a dull, gray dead-zone right in the middle, you have experienced sRGB interpolation. Why? Because standard CSS gradients mix red, green and blue channels mathematically straight across, which frequently drains the color intensity in the transition.
Modern CSS lets you solve this by explicitly choosing your interpolation color space. By shifting the calculation into OKLCH, the browser keeps lightness and chroma consistent all the way through the blend, ensuring your midpoint stays vibrant.
Here is how you write a clean gradient in CSS:
.hero {
background: linear-gradient(in oklch to right, oklch(0.7 0.2 30), oklch(0.7 0.2 260));
}
By adding in oklch right into your linear-gradient declaration, you tell the browser to transition smoothly across human-perceived color steps rather than raw sRGB numbers.
You can even control the direction the gradient travels around the color wheel by appending shorter hue or longer hue right after your color space definition, giving you total creative control over multi-stop color transitions.
When to Convert OKLCH to HEX (and when you can’t)
Even as web standards evolve, HEX codes remain baked into older design tools, codebase and team habits. But because HEX is strictly tied to the older sRGB color space, it comes with limitations.
If your OKLCH color lives safely inside the standard sRGB gamut, it translates to a HEX code cleanly. But if you build an electric, wide-gamut green or cyan that only modern screens can actually display, HEX doesn’t have the mathematical range to express it. The system is forced to clip or shift the color into the nearest available sRGB equivalent.
This is why modern design systems treat your OKLCH or Display P3 value as the primary source of truth. Always design in the wider space first, and let your tools or fallback declarations generate the HEX code second.
Browser support, fallbacks and gamut mapping
The good news is that `oklch()` isn’t a speculative future proposal. It is part of CSS Color Module Level 4 and supported natively across all modern browsers, including Chrome, Safari, Firefox, and Edge.
In fact, major frameworks like Tailwind CSS v4 use OKLCH for their default color systems.
Writing progressive CSS fallbacks
If you need to support legacy browsers that don’t understand modern CSS color functions, you can rely on standard CSS cascading rules. Declare a traditional sRGB value first, followed by your OKLCH declaration directly beneath it:
“`css
.button {
background: rgb(46 98 230); /* Fallback for older browsers */
background: oklch(0.55 0.21 262); /* Used by modern browsers */
}
Browsers that don’t recognize oklch() simply ignore the second line and use the RGB fallback, while modern browsers apply the OKLCH value automatically.
What happens when a display can’t show your color?
When an OKLCH color exceeds what a physical screen can display, the browser performs gamut mapping. Under the CSS Color 4 spec, the browser automatically scales back the color’s chroma (vividness) while keeping its lightness and hue angle completely intact. Because browser implementations can vary slightly, it is always wise to test your most vibrant hero colors on a standard display to confirm how they map.
Moving your palette outside the browser
Your OKLCH palette doesn’t have to stay stuck in a stylesheet. Because design software and app frameworks use different native formats, you can export your central OKLCH scale into whatever environment your team uses:
Adobe & Affinity apps: Import palette swatches directly via .ASE files for Photoshop, Illustrator and Affinity.
Design systems: Export as Figma Tokens (JSON) to keep your design components synchronized.
Native apps: Carry colors straight into mobile codebases using SwiftUI Color structs for iOS.
A practical OKLCH palette workflow
Transitioning to OKLCH doesn’t mean changing your entire creative process—it just gives you a smarter, more predictable engine under the hood. Whether you are building a brand-new design system or migrating an existing app, a repeatable workflow keeps your colors consistent from concept to production.
Here is a practical, step-by-step way to put OKLCH into practice:
- Pick a brand hue and a chroma that feels right on a Display P3 screen.
- Generate the ramp by stepping lightness evenly and easing chroma at the ends.
- Check contrast on your real text and background pairs.
- Export once to CSS, Figma Tokens, SwiftUI and Android so every platform matches.
- Add fallbacks for browsers and displays that can’t show the full gamut.
Frequently Asked Questions
For choosing colors by eye, yes: lightness and hue behave predictably, so scales, gradients, and themes need less manual correction. HSL is still fine for quick, same-hue tweaks.
No. It works on any display. Colors outside a display’s range are gamut-mapped, and you still get uniform lightness.
OKLCH is the polar (hue and chroma) form of OKLab, designed by Björn Ottosson. His original write-up is the best deep dive.
No. You can migrate gradually and mix formats in one stylesheet.
Try a real OKLCH workflow
The best thing to do is play around with OKLCH color for yourself. Move a hue around a wheel and watch the contrast ratio update is another. Prismii is made by Flatlander Studio for exactly this: a reactive gamut wheel, precision arc sliders, 48-step shade and tint generation, and export to CSS, Figma Tokens, .ase, Procreate and SwiftUI.
No subscription. The free tier is $0, and Pro is a one-time $14.99 purchase.
Download Prismii free on the App Store and build your first OKLCH scale today. And if your work leans more visual than technical, read our companion guide, Display P3 vs sRGB.
