By Calder WynneBrand and UI designer, 12 years·Updated
The classic rainbow color palette runs red , orange , yellow , green and blue , then indigo and violet in the full seven-color version. The strip above shows the five-color core, and the live preview lets you test any pair for contrast.
Fresh ideas, made simple
A short line of body text to test how readable these colors are.
These are the pure, maximum-saturation values, a screen convention rather than a measurement of light. Below you will find the RGB, HSL and CMYK values, contrast ratios I calculated, and the adjustments that make a rainbow behave in interfaces, print and rooms.
What Counts as a Rainbow Color Palette?
A rainbow palette is a set of hues in spectral order: red, orange, yellow, green, blue, indigo, violet. The mnemonic is ROYGBIV, or VIBGYOR when you read it backwards. The order follows wavelength, from red (the longest visible light) to violet (the shortest). In a real primary rainbow, red sits on the outer edge and violet on the inner edge.
Isaac Newton set the count at seven in his 1704 Opticks, partly to match the seven notes of a musical scale. Plenty of people see only five or six bands, which is why a five-color strip and the six-stripe pride flag both still read as a rainbow. Order is what matters: shuffle the same codes and you have a generic multicolor palette.
Rainbow Hex, RGB, HSL and CMYK Codes
Every value below is computed directly from the hex code. The CMYK column uses the simple mathematical conversion, so treat it as a starting point rather than a press-ready recipe.
Color
HEX
RGB
HSL
CMYK
Red
255, 0, 0
0°, 100%, 50%
0, 100, 100, 0
Orange
255, 127, 0
30°, 100%, 50%
0, 50, 100, 0
Yellow
255, 255, 0
60°, 100%, 50%
0, 0, 100, 0
Green
0, 255, 0
120°, 100%, 50%
100, 0, 100, 0
Blue
0, 0, 255
240°, 100%, 50%
100, 100, 0, 0
Indigo
75, 0, 130
275°, 100%, 25%
42, 100, 0, 49
Violet
139, 0, 255
273°, 100%, 50%
45, 100, 0, 0
The HSL column shows the logic. Every pure color has 100% saturation and 50% lightness, and only the hue angle changes: 0, 30, 60, 120, 240. That makes HSL the easiest format for building rainbow variations, since you can soften the whole set by changing one number.
Indigo, Violet and the Hues Between
Indigo is a deep blue-purple, and it matches the CSS keyword indigo. Violet is slipperier. is a bright electric violet, is the CSS darkviolet keyword, and the CSS keyword violet () is a pale pink-lilac that breaks the spectrum. Pick the violet that suits your background and stay consistent.
A five-color strip also leaves gaps. Hue jumps from green at 120° to blue at 240°, skipping a whole region. If a rainbow looks choppy, add one of these bridge colors:
Amber (45°), between orange and yellow
Chartreuse (90°), between yellow and green
Spring green (150°), just after green
Cyan (180°), the missing step before blue
Some designers add cyan and drop indigo, giving a clean eight-step ramp where each color sits roughly 30 to 60 degrees from its neighbour. For smooth data scales that is often better than the historical seven.
Why Pure Rainbow Colors Look So Harsh on Screen
Pure RGB colors push one or two channels to their maximum, so they sit at the very edge of what a display can show. No screen reproduces true spectral light, only an approximation. The other problem is uneven weight: is intensely bright while is dark, so side by side they feel like different volumes rather than a matched set.
The orange and green name trap
The CSS keyword orange is , not , and the CSS keyword green is a darker . The bright is called lime.
This causes real bugs. A teammate writes color: green expecting the rainbow green and gets a forest tone. If your palette needs exact values, use hex or HSL variables and skip the keywords.
Contrast and Accessibility for Rainbow Colors
I calculated these ratios with the WCAG relative luminance formula. Against a white background, blue scores 8.59:1, red 4.00:1, orange 2.53:1, green 1.37:1 and yellow 1.07:1. WCAG AA asks for 4.5:1 for normal text and 3:1 for large text and interface components, so only blue passes for body text, and red works for large headings alone.
Which pure rainbow color has the best contrast against a white background?
Blue is the darkest pure hue, giving 8.59:1 on white, while yellow manages only 1.07:1 and green 1.37:1.
Flip the logic and use the colors as fills with dark text. Here is dark gray on each pure color:
Yellow: 11.8:1 (excellent)
Green: 9.2:1 (excellent)
Orange: 4.99:1 (passes AA)
Red: 3.2:1 (large text only)
Blue: 1.5:1 (fails, use white text instead)
Yellow also pairs naturally with black, which our black and yellow combinations page explores in depth. On one dashboard I rebuilt, a rainbow of status chips told red from green by hue alone, and red against green measures just 2.9:1. We added icons and labels, because color should never carry meaning by itself (WCAG 1.4.1). It took an hour and fixed the problem for everyone, not only color-blind users.
Dark text wins on yellow, green and orange; red and blue need white text instead.
Pastel, Muted and Dark-Mode Rainbow Palettes
Taming a rainbow means lowering saturation and evening out lightness. The Soft Prism set (, , , , ) keeps the spectral order but sits at a similar brightness, so it suits nurseries, stationery and soft illustrations. For more gentle combinations, browse our cute colors page.
Pure Spectrum
Maximum saturation for kids' art, stickers and playful hero graphics.
Soft Prism
Pastel rainbow for nurseries, stationery and gentle app illustrations.
Balanced Rainbow
Even-weight hues for charts, tags and category labels in interfaces.
Night Prism
Bright rainbow accents on a near-black base for dark mode dashboards.
For interfaces, the Balanced Rainbow set (, , , , ) deepens the yellow and softens the blue so that each hue carries equal visual weight. The Night Prism set puts brights such as and on a near-black . Dark backgrounds make rainbow accents glow, and our night sky palette offers more deep blues to build on.
Using a Rainbow Palette in Web and UI Design
The safest rule is one rainbow per screen, set against a quiet neutral. A soft off-white such as (see the #F8F8F8 color page) lets the hues stand out without glare. Spend the rainbow on categories, charts, tags and illustrations, and keep body text in a neutral.
Store the colors as tokens so one change updates everything:
Name tokens by role as soon as the palette is in production (for example --tag-urgent), so a later palette swap does not break meaning. Use hover and focus states that change brightness, not just hue, and keep any rainbow element away from long reading text.
Rainbow Gradients in CSS Without the Muddy Middle
A rainbow gradient is the obvious use of this palette, but the default blending is rough. A plain sRGB blend from to averages the channels and lands on rgb(0, 128, 128), a dull dark teal, rather than a bright cyan. Adding explicit stops fixes it, and so does choosing a better interpolation space:
What do you get at the midpoint of a plain sRGB gradient from #00FF00 to #0000FF?
Averaging the channels gives rgb(0, 128, 128), a dark teal, because sRGB blending never passes through bright cyan.
The second rule needs a recent browser. The longer hue keyword sends the gradient around the long way, through yellow, green and cyan, instead of cutting through purple. For the short red-to-violet route, see our red to purple gradient page.
Try this: Build the same gradient twice, once with five hex stops and once with the oklch version, and place them one above the other. Look at the green-to-blue transition in each and note which one looks cleaner.
Blending green into blue in plain sRGB lands on dull teal #008080, but a cyan stop keeps it bright.
Rainbow Colors in Branding, Print and Pride Flags
In print, pure and are the first to fail. Their bright intensity falls outside what CMYK inks reproduce, so printers convert them to the nearest possible color. I once approved a poster on screen, and the proof came back with a green noticeably duller than the monitor suggested. Since then I design rainbow work with print-safe values from the start and request a proof for any rainbow-critical job.
The rainbow flag is the best-known real-world example. Gilbert Baker made the first one in San Francisco in 1978, and the common six-stripe version, red, orange, yellow, green, blue and violet, followed in 1979. There is no single official hex set, so communities publish their own versions. For brand work, a rainbow works best as a controlled accent: a small mark or stripe, with a restrained neutral palette around it.
Rainbow Colors for Interiors, Fashion and Art
In rooms, a full-saturation rainbow overwhelms quickly. Treat it as a 10% accent against a calm base: bookshelves arranged by color, a striped throw, or a single painted door. A neutral such as light beige gives warmth that a stark white wall cannot, and the rainbow items still look intentional against it.
In fashion, color-blocking pairs two or three adjacent rainbow hues, such as orange with yellow, instead of the whole spectrum at once. For painting, remember that pigment mixing follows different rules from screen light. A painter’s rainbow built from pigment primaries will not match , so mix toward the hue you want and compare it against a printed swatch under daylight.
Every color in this palette
Rainbow Color Palette: questions people ask
What are the 7 rainbow colors in order with hex codes?
Red #FF0000, orange #FF7F00, yellow #FFFF00, green #00FF00, blue #0000FF, indigo #4B0082 and violet #8B00FF. The order runs from the longest visible wavelength to the shortest, and ROYGBIV is the mnemonic.
What is the hex code for violet in a rainbow?
There is no single official value. #8B00FF is a bright electric violet that suits a vivid screen rainbow, while #9400D3 is the CSS darkviolet keyword. The CSS keyword violet (#EE82EE) is a pale pink-lilac and looks out of place in a rainbow.
Is indigo a real rainbow color?
Indigo is traditional rather than obvious. Isaac Newton counted it as the seventh band in 1704, but most people cannot pick it out from blue and violet. Many designers use six colors and skip it.
Which rainbow colors are readable as text on white?
Only blue (#0000FF) passes WCAG AA for normal text on white, at 8.59:1. Red reaches 4.00:1, which suits large text only, and orange, green and yellow fail. Use them as fills with dark text on top instead.
What are good pastel rainbow hex codes?
Try #F7A8A8, #F9CFA0, #FAEFA0, #B7E3B5 and #A9CBEF for red, orange, yellow, green and blue. They keep the spectral order but share a similar lightness, so none of them shouts over the others.