OKLab vs sRGB: why some gradients look muddy
Blue to yellow through grey? That is sRGB interpolation. What OKLab does differently and how to use it in CSS today.
Updated 2026-11-16
The muddy middle
By default a CSS gradient mixes colours channel by channel in sRGB. Halfway between a saturated blue and a saturated yellow the red, green and blue channels average out to a dull grey, so the gradient passes through a muddy band that neither colour contains.
Perceptual colour spaces
OKLab is designed so that equal steps look like equal changes to the eye. Interpolating there keeps lightness and saturation steady, so the midpoint of blue and yellow stays colourful and the transition looks even.
Modern CSS lets you choose the interpolation space directly in the gradient.
.card {
/* sRGB (default) */
background: linear-gradient(90deg, #2563eb, #facc15);
}
.card--oklab {
background: linear-gradient(in oklab 90deg, #2563eb, #facc15);
}When to pick which
Use OKLab for vivid multi-hue gradients and for anything where an even transition matters. sRGB is still fine for subtle tints and for fades to transparent, and it is what older browsers use when they ignore the `in oklab` hint.
In CHROMA79 every gradient layer has an interpolation switch, mesh points always blend in OKLab, and the CSS export writes `in oklab` when you choose it.