Why CSS gradients look muddy and how to fix it
Default CSS gradient interpolation happens in sRGB, which is a display-encoding space optimized for hardware signal levels, not perceptual uniformity. When you interpolate from red (#ff0000) to blue (#0000ff) in sRGB, the mathematical midpoint (#7f007f) is a dark, desaturated purple that looks significantly dimmer than either endpoint. The resulting gradient has a clearly visible dark band through the center. The CSS Color Level 4 specification introduced gradient interpolation in perceptually uniform spaces: `background: linear-gradient(in oklch, red, blue)`. In OKLCH, the interpolation path stays at constant perceived lightness and saturation — producing a gradient that maintains visual vibrancy across its full width. Browser support for OKLCH gradient interpolation is now at 93% globally (Chrome 111+, Firefox 113+, Safari 16.2+), making it safe to use in most production contexts with a sRGB fallback for older browsers.
