A brand color can look uneven when its hue changes: some hues appear brighter than others even when their HSL lightness stays fixed. OKLCH makes hue adjustments while keeping perceived brightness more consistent. It also gives you separate controls for building lighter, darker, or more vivid variants. section 7.1.4
The CSS function oklch(L C H) uses three coordinates:
- Lightness (L) runs from 0 for black to 1 for white; percentages also work. section 7.1.4
- Chroma (C) measures intensity: 0 is gray, while higher values are more vivid. Its usable upper end depends on hue and lightness. section 7.1.4
- Hue (H) is an angle around the color wheel, from 0 to 359 degrees. section 7.1.4
Style a heading
h1 { color: oklch(0.42 0.2 328); } sets its lightness, chroma, and hue in that order. To make a scale, hold hue and chroma steady while changing lightness; to change vividness, hold lightness and hue steady while changing chroma. section 7.1.4
Listing 7.1 Creating a color scale by varying lightness in the OKLCH color space
.brand-light { background: oklch(0.8 0.15 350); }
.brand-medium { background: oklch(0.6 0.15 350); }
.brand-dark { background: oklch(0.4 0.15 350); }
Compare three CSS backgrounds with the same chroma and hue. Only lightness changes, producing light, medium, and dark brand variants. section 7.1.4
For a dark-mode starting point, invert lightness with Ldark = 1 − L while retaining chroma and hue. A paired palette may also reduce chroma and shift hue slightly; test each resulting color against its new background for contrast. Check colors on regular monitors, too: some OKLCH values that display on Display P3 screens will not work on less capable displays. section 7.5.2 section 7.5.4 section 7.1.4

