Skip to the color picker

Blue to gold gradient

A smooth blue 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, #0000ff, #034df1, #2d6de2, #5185d1, #7499bf, #96aba8, #b9bb8d, #dcc967, #ffd700);
background: linear-gradient(90deg in oklab, #0000ff, #ffd700);

Tailwind CSS v4

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

Colors along the gradient

7

How blue 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%. Blended in plain sRGB, the middle is #806c80 with a chroma of 0.039. OKLab gives #7499bf with 0.07, so the sRGB version looks noticeably grayer in the middle.

Blend inGradient previewMiddle colorLightnessChroma
OKLab#7499bf66.9%0.07
OKLCH#00b09866.9%0.248
sRGB#806c8055.5%0.039
LCH#ff317267.5%0.327
HSL#ff009365.1%0.266

Questions about this gradient

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

Use background: linear-gradient(90deg in oklab, #0000ff, #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 blue and gold?

Blended in OKLab, the color halfway between blue and gold is #7499bf. A plain sRGB blend gives #806c80.

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

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