Rainbow colors in order
The seven colors of the rainbow, in order, are red, orange, yellow, green, blue, indigo and violet, remembered as ROY G BIV. Red is always on the outside of the bow and violet on the inside.
The 7 colors of the rainbow
| Color | Hex | Wavelength |
|---|---|---|
| Red | #FF0000 | 620–750 nm |
| Orange | #FF7F00 | 590–620 nm |
| Yellow | #FFFF00 | 570–590 nm |
| Green | #00FF00 | 495–570 nm |
| Blue | #0000FF | 450–495 nm |
| Indigo | #4B0082 | 425–450 nm |
| Violet | #8B00FF | 380–425 nm |
The hex codes are the conventional "rainbow" colors used in design. Real spectral colors are more saturated than a screen can show, and the wavelength boundaries are approximate: the spectrum is continuous, and where one named color ends and the next begins is a matter of convention.
Why the rainbow is always in this order
A rainbow forms when sunlight enters raindrops, bends (refracts), reflects off the back of each drop and bends again on the way out. Shorter wavelengths bend more than longer ones, so the colors fan out by wavelength, from long (red) to short (violet). That physical sorting is why the order never changes.
The main bow appears about 42 degrees from the point directly opposite the sun. A fainter secondary rainbow, at about 51 degrees, comes from light reflecting twice inside the drops, and its colors are reversed: violet on the outside, red on the inside.
ROY G BIV and other ways to remember it
- ROY G BIV: the initials of red, orange, yellow, green, blue, indigo, violet.
- "Richard Of York Gave Battle In Vain": a British mnemonic with the same initials.
- Long to short: the order runs from the longest visible wavelength to the shortest.
Why indigo? Six or seven colors
Isaac Newton named seven colors in his work on optics, partly to match the seven notes of the musical scale. Indigo, between blue and violet, is hard for many people to pick out, and some modern descriptions list six colors instead. Both are conventions for a continuous spectrum.
Using rainbow colors in design
Full-strength rainbow colors are loud and vary a lot in lightness (yellow is far lighter than blue), so they are rarely used as-is. Softer versions such as pastel rainbows, or rainbows with matched lightness in OKLCH, look more even. For charts, use a color-blind-safe data visualization palette rather than a raw rainbow.
Pastel rainbow
Even-lightness rainbow (OKLCH)
The second row keeps every color at the same OKLCH lightness, so none jumps out more than the others. That is the trick behind rainbow palettes that look calm rather than garish, and it keeps text contrast predictable on each color.
Frequently asked questions
What are the 7 colors of the rainbow?
Red, orange, yellow, green, blue, indigo and violet.
What color is at the top of a rainbow?
Red, on the outside of the main bow. In a double rainbow the second bow has red on the inside.
Is pink in the rainbow?
No. Pink and magenta are not spectral colors; they are mixtures of red and blue light, the two ends of the spectrum.
How many colors are in a rainbow?
A rainbow is a continuous spectrum with countless hues. By convention we name seven, or sometimes six without indigo.