Cyan to violet gradient
A smooth cyan to violet gradient in CSS, blended in OKLab so the middle stays clean. Change the angle, add colors and copy the code.
Colors
OKLab keeps the middle bright. sRGB is how old browsers blend and often turns gray in the middle.
CSS
background: linear-gradient(90deg, #00ffff, #66f1fd, #8be3fb, #a5d5f9, #b9c6f7, #c9b7f5, #d8a7f3, #e495f0, #ee82ee);
background: linear-gradient(90deg in oklab, #00ffff, #ee82ee);Tailwind CSS v4
bg-linear-90/oklab from-[#00ffff] to-[#ee82ee]Colors along the gradient
How cyan and violet blend in each color space
The same two colors give a different middle depending on the space the browser blends in. These are the exact colors at 50%. These two colors blend almost the same way in every space: the middle is #b9c6f7 in OKLab and #77c1f7 in sRGB, so any of them works.
| Blend in | Gradient preview | Middle color | Lightness | Chroma |
|---|---|---|---|---|
| OKLab | #b9c6f7 | 83.4% | 0.07 | |
| OKLCH | #a2c9ff | 83.4% | 0.17 | |
| sRGB | #77c1f7 | 78.2% | 0.107 | |
| LCH | #8fcfff | 83.4% | 0.173 | |
| HSL | #4444f3 | 51.5% | 0.251 |
Questions about this gradient
How do I make a cyan to violet gradient in CSS?
Use background: linear-gradient(90deg in oklab, #00ffff, #ee82ee). Add a line before it with the sRGB version for very old browsers. Interpolation in OKLab works in all current browsers.
What color is halfway between cyan and violet?
Blended in OKLab, the color halfway between cyan and violet is #b9c6f7. A plain sRGB blend gives #77c1f7.
How do I make a cyan to violet gradient in Tailwind CSS?
In Tailwind CSS v4 use the classes bg-linear-90/oklab from-[#00ffff] to-[#ee82ee].