Mrs. Lastri mixes two dyes in the wok: write your own color-mix(), the browser computes the colour, and six test cloths on the drying line show the same mix…
Why it matters
One brand variable can become a whole palette (hover, active, tint, a see-through version) in plain CSS, with no Sass and no dozens of hardcoded hex values. Knowing why oklch differs from srgb keeps your mixes from ever looking "muddy".
The key idea
The colour space decides the path of the mix, not just its format
Common mistakes
Mixing two contrasting colours gives a dirty grey middle In srgb the straight line between two complementary colours passes near grey. Use in oklch (or oklab/lab when the hue must not turn) for a mix that stays lively.
Unsure about percentages that do not add up to 100 Valid, but they behave differently: red 30%, blue 30% is scaled to 50/50 and its alpha multiplied by 0.6 (faded). red 70%, blue 70% is scaled to 50/50 without touching the alpha. Clearest: write a pair that adds up to 100.
Using color-mix() for a colour that never changes If both colours are constant, so is the result: write the result itself (this playground shows it), easier to read and it works in older browsers. color-mix() pays off when one of them is a variable, like var(--brand), a theme or a state.
Try it in this playground
Compare orange + blue in srgb, then oklch Read the C on the srgb and oklch cloths. A small number = muddy.
In oklch, switch the hue to longer The hue turns round the other side of the colour wheel. The middle can turn green.
Write two percentages that add up to less than 100 Say 30% and 30%. Read the percentage arithmetic: scaled to 50/50, alpha × 0.6.
Mix a colour with transparent The result stays the same colour, only its alpha drops, because the mix is premultiplied.