MarketExploreTry on
Pricing
Sign inStart
Field GuideColour
Colour

Rainbow gradients that don't look like a default preset

The default rainbow has a glaring yellow stripe and a dark blue hole in it. Fix the lightness, choose your arc and the spectrum becomes one of the most joyful tools you have.

GradientlyVerified Gradiently account·October 1, 2026·5 min read
Cover: February Tapestry · GR·3ZKM·09

The short version

  • A rainbow gradient blends through the hues of the spectrum, and the default version looks cheap because its colours have very different lightness.
  • In OKLCH, pure yellow has a lightness of about 97% while pure blue sits near 45%, which is why a default rainbow shows a bright stripe and a dark band.
  • Rainbow gradients look designed when you keep every stop at a similar lightness, lower the chroma a little and use only the part of the spectrum you need.
  • CSS can blend a rainbow for you with linear-gradient(in oklch longer hue, ...), which travels all the way around the hue wheel between two colours.
  • Text on a rainbow needs a calm area or a band behind it, because the contrast changes along the whole gradient.
On this page
Why the default rainbow looks cheapHow to make a rainbow gradient look designedRainbow gradient codes you can copySmooth rainbows in CSS with OKLCH hue interpolationPutting text on a rainbow gradientWhere rainbow gradients fit

A rainbow gradient blends through the hues of the spectrum, from red through orange, yellow, green, blue and violet. The version most tools give you looks like a default because it jumps in brightness: a glaring yellow stripe, a dark blue band and hard edges between them. A rainbow that looks designed keeps every colour at a similar lightness, uses a little less saturation, and often covers only part of the spectrum.

This guide shows why the preset looks wrong, three ways to fix it, copyable rainbow codes and the CSS that makes smooth rainbows in modern browsers. If hue, lightness and chroma are new to you, colour codes explained covers them first.

Why the default rainbow looks cheap

The classic rainbow is built in HSL by stepping the hue while holding saturation and lightness fixed. HSL's lightness is a formula, not a measure of how bright colours look. To your eye, pure yellow is far brighter than pure blue, even though HSL calls them both 50%. OKLCH measures perceived lightness, and the numbers show the problem clearly.

Red#ff0000

HSL lightness

50%

OKLCH lightness

62.8%
Yellow#ffff00

HSL lightness

50%

OKLCH lightness

96.8%
Green#00ff00

HSL lightness

50%

OKLCH lightness

86.6%
Cyan#00ffff

HSL lightness

50%

OKLCH lightness

90.5%
Blue#0000ff

HSL lightness

50%

OKLCH lightness

45.2%
Magenta#ff00ff

HSL lightness

50%

OKLCH lightness

70.2%
ColourHexHSL lightnessOKLCH lightness
Red#ff000050%62.8%
Yellow#ffff0050%96.8%
Green#00ff0050%86.6%
Cyan#00ffff50%90.5%
Blue#0000ff50%45.2%
Magenta#ff00ff50%70.2%
HSL says these are equally light. Perceived lightness ranges from 45% to 97%, which is why the default rainbow looks striped.
The same journey around the hue wheel. The second holds every stop near 72% OKLCH lightness, so no colour jumps out or sinks.

How to make a rainbow gradient look designed

  1. 1

    Even out the lightness

    Pick a single perceived lightness, such as 72% in OKLCH, and hold every stop there. This one change removes the yellow stripe and the blue hole.

  2. 2

    Lower the chroma a little

    Fully saturated screen colours fight each other. A chroma around 0.12 in OKLCH keeps every hue vivid and still inside what normal screens can show.

  3. 3

    Use an arc, not the whole wheel

    Three or four neighbouring hues, such as coral to gold or teal to violet, read as a considered choice. The full spectrum reads as a test pattern unless it is the point.

  4. 4

    Give it a ground

    A rainbow on white feels like a children's toy; the same rainbow rising out of near-black feels like light through a prism. Decide which one you want.

  5. 5

    Add texture or softness

    Grain, blur or a slow radial fall-off turns bands of colour into light. See grainy gradients for the grain side.

Rainbow gradient codes you can copy

The first three cover the whole spectrum at different lightness levels. The rest are arcs: a part of the rainbow chosen for a mood, which is how most rainbow identities actually work.

Eight rainbow gradients. Balanced and pastel keep every stop at one lightness; the arcs choose a corner of the wheel; the last two use the spectrum as light.

Smooth rainbows in CSS with OKLCH hue interpolation

Modern CSS can travel around the hue wheel for you. Setting the interpolation to oklch and the hue method to longer hue makes the browser go the long way between two colours, so two stops at the same hue produce a full, even rainbow. It works in current versions of Chrome, Edge, Safari and Firefox; check MDN's compatibility table for your audience.

css
.rainbow {
  /* Fallback: hand-picked stops at even lightness */
  background: linear-gradient(90deg, #e68485, #d49648, #9bb054, #43bd99, #2fb5d8, #87a0f0, #c68bd3);
  /* One colour, all the way round the hue wheel, at one lightness */
  background: linear-gradient(in oklch longer hue 90deg, oklch(72% 0.12 20), oklch(72% 0.12 20));
}

.rainbow-arc {
  /* Only the short way from coral to teal, still perceptually even */
  background: linear-gradient(in oklch 90deg, oklch(72% 0.12 20), oklch(72% 0.12 170));
}
The first rule draws a full rainbow from a single colour. The second draws an arc, taking the shorter route between two hues.

Keep chroma modest when you do this. At high chroma some hues, especially blue and violet, fall outside what an ordinary sRGB screen can show, and the browser has to squash them back, which brings back uneven bands. More on this in smoother CSS gradients with OKLCH.

Putting text on a rainbow gradient

A rainbow is the hardest background for text because contrast changes along its whole length. Dark text that reads well over teal can vanish over violet. Place words over the calmest part, set them on a quiet band or card, or use a pastel rainbow with dark type and check the lightest and darkest points behind every line. Text on a gradient goes through the options.

Spring studio
Hello, colour.
Gradiently · @gradiently

Without help, the words cross every hue and their contrast keeps changing.

Spring studio
Hello, colour.
Gradiently · @gradiently

With the field calming behind the words, the rainbow stays joyful and the line reads.

Where rainbow gradients fit

  • Creative tools and colour products, where the spectrum shows range
  • Children's brands and education, usually in the pastel version
  • Music, festivals and nightlife, as a prism on a dark ground
  • Holographic and iridescent looks, as a pale pearl shimmer; see holographic gradients
  • Pride campaigns, where the rainbow flag has its own meaning and its own six stripes, so use it with intent rather than as decoration

Choose the arc first

Before you reach for the full spectrum, ask which three or four hues carry the mood. Most rainbow designs that feel expensive are really arcs.

Questions people ask

How do I make a rainbow gradient in CSS?

Use linear-gradient(in oklch longer hue 90deg, oklch(72% 0.12 20), oklch(72% 0.12 20)) for a smooth, even rainbow, with a hex-stop gradient before it as a fallback.

Why does my rainbow gradient have a bright yellow stripe?

Yellow is perceived as far lighter than blue or red at the same HSL lightness. Hold every stop at one perceived lightness, such as 72% in OKLCH, to remove the stripe.

What are the hex codes for a pastel rainbow gradient?

Try #fcbfbe, #efca9f, #cbd8a5, #a3e0ca, #9ddcf1, #bfd0ff and #e6c3ee, which all sit at a similar high lightness.

Can you put text on a rainbow gradient?

Yes, but the contrast changes across the gradient. Put text over the calmest area, on a band or card, or use a pastel rainbow with dark text and check every point behind the words.

Share this guide

Written by GradientlyVerified Gradiently account

The team behind Gradiently, a design tool built around Marks: living gradients that make everything you design look like yours.

See our profile

On this page

Why the default rainbow looks cheapHow to make a rainbow gradient look designedRainbow gradient codes you can copySmooth rainbows in CSS with OKLCH hue interpolationPutting text on a rainbow gradientWhere rainbow gradients fit

Share this guide

Next in Colour

Color contrast: readable text for everyone

Keep reading

All Colour guides
Gradients

Holographic gradients and iridescence, explained

5 min read

Holographic foil, soap bubbles and pearl all change colour as you move. A flat screen can't do that, but a well-built gradient can convince the eye it does.

CSS and web

CSS gradient OKLCH interpolation for smoother blends

5 min read

Most dull, grey-middled gradients are not a colour problem but a maths problem. Two words, in oklch, change where the browser does the maths.

Gradients

Pastel gradients that stay fresh, not sugary

5 min read

Pastels are the easiest gradients to like and the easiest to overdo. A few rules keep them feeling like spring light on paper rather than a birthday cake.

Find the look that’s only yours.

Every Mark is a living background with one owner. Try an unclaimed Mark, and claim yours when it feels right.

Start designingSee the launch offer

Marks left to claim

50of 1,000

950 claimed so farFind yours

Check a certificate

Type a certificate number or a Mark’s code to see who owns it.

Works with ChatGPT and Claude

Ask your AI for a design. It makes it in your Mark, ready to edit.

ChatGPTClaude
How to connect

Product

  • Market
  • Explore
  • Pricing
  • Launch packs
  • Certificates

Learn

  • Field Guide
  • Help centre
  • What’s new

Developers

  • Overview
  • ChatGPT and Claude
  • API reference
  • API keys

Company

  • About
  • Contact us
  • Sign in

Legal

  • Terms
  • Privacy
  • Refunds
  • Mark protection
  • Cookies
  • All policies
Move through the letters. Each one wears a real Mark.Touch a letter to see its Mark.One name. Ten Marks inside it.
© 2026 Gradiently