Skip to the color picker

Purple to gold gradient

A smooth purple to gold gradient in CSS, blended in OKLab so the middle stays clean. Change the angle, add colors and copy the code.

Colors

Blend in

OKLab keeps the middle bright. sRGB is how old browsers blend and often turns gray in the middle.

Type
90°

CSS

background: linear-gradient(90deg, #800080, #8f3180, #9f4d7d, #ae657a, #be7d73, #ce936a, #deaa5b, #efc044, #ffd700);
background: linear-gradient(90deg in oklab, #800080, #ffd700);

Tailwind CSS v4

bg-linear-90/oklab from-[#800080] to-[#ffd700]

Colors along the gradient

7

How purple and gold 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 #be7d73 in OKLab and #c06c40 in sRGB, so any of them works.

Blend inGradient previewMiddle colorLightnessChroma
OKLab#be7d7365.4%0.084
OKLCH#ed583f65.4%0.188
sRGB#c06c4061.6%0.122
LCH#fa495466.2%0.213
HSL#c0000f50.7%0.207

Questions about this gradient

How do I make a purple to gold gradient in CSS?

Use background: linear-gradient(90deg in oklab, #800080, #ffd700). 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 purple and gold?

Blended in OKLab, the color halfway between purple and gold is #be7d73. A plain sRGB blend gives #c06c40.

How do I make a purple to gold gradient in Tailwind CSS?

In Tailwind CSS v4 use the classes bg-linear-90/oklab from-[#800080] to-[#ffd700].