color-mix() blends two colours together in a specified colour space, returning a new colour. It is supported in all modern browsers and eliminates the need for preprocessor colour functions like Sass's mix().
Syntax
color-mix(in <colorspace>, <color1> <percentage>, <color2>). If the percentages do not add up to 100 %, the remainder is transparent, effectively diluting the result.
Colour Spaces
The colour space affects the midpoint of the blend. in srgb is the default. in oklch produces more vibrant, perceptually even blends. in hsl can create rainbow effects by interpolating hue.
Practical Uses
Generate tints, shades, and disabled-state colours without a preprocessor.
Combine color-mix() with CSS custom properties to build entire design-token colour scales at runtime — no build step, no Sass, just one base colour variable and math in the browser.