concept
hue-interpolation — CSS reference
Polar interpolation must choose a path around the hue circle. Shorter and longer choose different arcs; increasing and decreasing specify direction. Near the wraparound, the naive arithmetic average can be the opposite hue. The chosen arc affects intermediate colors, not the endpoints.
Formal Syntax & Structure
css syntaxcss
color-mix(in hsl shorter hue, ...); color-mix(in hsl longer hue, ...);Working Example
Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>CSS color lab</title><style>body {margin:0} .sample {height:12px;background:#006050}p {padding:12px;background:white;color:black;border:2px solid currentColor} #a{color:color-mix(in hsl shorter hue, hsl(350 100% 50%), hsl(10 100% 50%))} #b{color:color-mix(in hsl longer hue, hsl(350 100% 50%), hsl(10 100% 50%))}
</style><body><p id="a">First color sample</p><p id="b">Second color sample</p></body></html>