Blend blue into yellow with linear-gradient(90deg, blue, yellow) and the middle turns a dull grey. That isn't your colours' fault: by default browsers mix gradient colours in sRGB, where the straight line between two colours often passes through a desaturated zone.
The fix: interpolate in OKLab or OKLCH
.muddy { background : linear-gradient ( 90deg , blue , yellow ) ; } .clean { background : linear-gradient ( in oklab 90deg , blue , yellow ) ; } .vivid { background : linear-gradient ( in oklch 90deg , blue , yellow ) ; }
Enter fullscreen mode
Exit fullscreen mode
oklab is perceptually even, so the midpoint looks like a real halfway colour.
oklch travels around the hue wheel, giving brighter, rainbow-like transitions (use shorter hue / longer hue to choose the direction).
Keep a fallback
Colour-space interpolation is supported in current Chrome, Edge, Firefox and Safari, but declare the plain version first so older browsers still get a gradient:
.card { background : linear-gradient ( 90deg , blue ,…