# OKLCH

OKLCH writes a colour as three numbers in the Oklab colour space: perceived lightness L from 0 to 1, chroma C for how colourful it is, and hue H as an angle. It comes from CSS Color Module Level 4 and works in every current browser. Because L follows how light a colour looks, Meadowstack generates its whole palette in OKLCH and measures contrast from the same numbers.

Checked 2 December 2026. By Bohuslav Poláček. https://meadowstack.com/glossary/oklch/

*The light theme's neutrals in the kit's generated palette.css: chroma 0, so only lightness separates page, hover, text and ring.*

From `packages/kit/src/styles/palette.css` in the Meadowstack repository:

```css
:root {
  --frame: oklch(0.975 0 0);
  --canvas: oklch(0.983 0 0);
  --surface: oklch(1 0 0);
  --surface-subtle: oklch(0.985 0 0);
  --surface-hover: oklch(0.97 0 0);
  --surface-active: oklch(0.94 0 0);
  --surface-inverse: oklch(0.22 0 0);
  --surface-raised: oklch(1 0 0);
  --fg: oklch(0.235 0 0);
  --fg-muted: oklch(0.44 0 0);
  --fg-subtle: oklch(0.52 0 0);
  --fg-disabled: oklch(0.72 0 0);
  --fg-inverse: oklch(0.985 0 0);
  --border: oklch(0.91 0 0);
  --border-strong: oklch(0.86 0 0);
  --border-control: oklch(0.65 0 0);
  --border-hover: oklch(0.585 0 0);
  --primary: oklch(0.235 0 0);
  --primary-hover: oklch(0.32 0 0);
  --primary-fg: oklch(0.99 0 0);
  --ring: oklch(0.4 0 0);
```

## Why it matters in a business app

A business app is mostly greys: the page, a card, the hovered row of a table, the selected row, three levels of text. In OKLCH those steps are a single number. The kit's page is `oklch(1 0 0)`, a hovered row `0.97`, a selected one `0.94`, muted text `0.45`: you can read the hierarchy off the file.

Status colours gain the most. A warning and an info chip at the same L look equally light, so neither shouts louder than the other because of its hue. With HSL the same lightness value gives a bright yellow and a dark blue, and every pair is tuned by eye.

## How Meadowstack handles it

- **Two inputs.** `packages/kit/src/tokens/inputs.ts` sets the page colour per theme (`oklch(1 0 0)` light, `oklch(0.155 0 0)` dark) and one contrast value. `palette.ts` derives every neutral as an offset from the page.
- **Chroma 0.** The house look is pure grey (decision 0012, `docs/decisions/0012-greyscale.md`): a client theme can tint the neutrals by giving the page a hue and some chroma.
- **One maths.** `oklch.ts` converts OKLCH to sRGB with Björn Ottosson's matrices to measure WCAG contrast, the same code path as `scripts/check-contrast.mjs`, so the generator and the guard cannot disagree.
- **Never by hand.** `npm run tokens` writes `palette.css`; `npm run check:tokens` fails when a component writes `oklch()`, hex, rgb or hsl itself.

## Common mistakes

- **Reading the hue like HSL.** Hue angles differ between the spaces: 0deg is red in `hsl()` and magenta in `oklch()`.
- **Pushing chroma too far.** Not every OKLCH value fits in sRGB. The kit's converter clamps each channel to the screen's range, so a token that asks for more colour than the screen has quietly loses it.
- **Writing literals in components.** A colour typed into a class or a style skips the dark theme and every client theme. Use the [semantic tokens](https://meadowstack.com/glossary/semantic-color-tokens/).

## Questions

### Do browsers support OKLCH?

Yes. MDN lists oklch() as Baseline, widely available across browsers since May 2023.

### What does a chroma of 0 mean?

No colour at all: the value is a grey whose lightness is L. The kit's neutrals are written this way, so the page, the surfaces and the text differ only in lightness.

### Is OKLCH the same as LCH?

No. Both are lightness, chroma and hue, but OKLCH is built on Oklab and LCH on CIELAB, so the same numbers give different colours and the hue angles do not match.

### Can I bring my brand colour into Meadowstack's palette?

Yes, through a client theme: it overrides the tokens for light and dark, and the contrast guard can check the theme file before it ships.

## Sources

- [MDN, oklch() (CSS Color Module Level 4)](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/oklch), checked 2 December 2026

## Related

- [APCA](https://meadowstack.com/glossary/apca/) (Glossary)
- [Contrast ratio](https://meadowstack.com/glossary/contrast-ratio/) (Glossary)
- [Dark mode](https://meadowstack.com/glossary/dark-mode/) (Glossary)
- [Semantic colour tokens](https://meadowstack.com/glossary/semantic-color-tokens/) (Glossary)
- [Contrast checker: APCA and WCAG 2](https://meadowstack.com/tools/apca-contrast-checker/) (Tools)
- [Contrast in business apps: what an audit of our demo found, and how we fixed it](https://meadowstack.com/blog/contrast-in-business-apps/) (Blog)
