Color Memory Game
By John K.··15 min read

Rainbow colors in order: rendered from raindrops, and measured

Red sits on the outside at 42.44 degrees and violet on the inside at 40.57, and that order never changes. Rendered from water dispersion and Airy theory, the whole bow is 1.873 degrees wide, the sun is as wide as the gap from red to green, and excitation purity falls from 99.7 percent at the red edge to 9.8 percent at the violet edge.

Red is on the outside and violet is on the inside, and that order never changes. In a primary rainbow red arrives 42.44 degrees from the point directly opposite the sun and violet arrives at 40.57. Every band in between falls in wavelength order, because the refractive index of water falls smoothly with wavelength. Nothing about that is negotiable, which is why the answer to the order question is always the same.

The part that does not survive contact with the numbers is the count. Seven named bands is a naming convention, and I wanted to know what the sky actually puts in each of those seven places. So I rendered a rainbow from the refractive index of water and measured it. The whole bow turns out to be 1.873 degrees wide, the sun is as wide as the distance from red to green inside it, and the inner half of the bow is not blue and violet at all. It is a pale wash.

How I measured it

This runs on the same spectral toolkit as why the sky is blue and why sunsets are red, with the atmosphere swapped out for a single spherical drop of water.

  • The water. Refractive index from Daimon and Masumura, who measured distilled water from the ultraviolet into the near infrared. Their Sellmeier fit gives 1.33335 at the sodium line, 1.34356 at 400 nm and 1.33052 at 700 nm. That difference of about one percent across the visible range is the entire reason a rainbow has colors.
  • The light going in. The ASTM G173-03 direct beam, which is sunlight after the atmosphere has already taken its cut.
  • The path through the drop. A ray trace in the scattering plane with vector refraction and reflection, carrying Fresnel amplitudes for both polarisations and the optical path length along the way. Two chords through the drop gives the primary bow, three gives the secondary.
  • The bow itself. Geometric optics says the intensity at the rainbow angle is infinite, which is wrong. Near the minimum deviation ray the emerging wavefront is cubic, so the diffraction integral over it collapses to an Airy function. I take the cubic coefficient from the traced wavefront rather than from a tabulated constant, which keeps the whole thing self contained.
  • The blur. The sun is not a point. Every profile is convolved with a uniform solar disc of angular radius 0.2665 degrees, and averaged over a spread of drop sizes, because real rain is not monodisperse.
  • The color. CIE 1931 two degree observer, sRGB, and CIEDE2000 for every difference quoted below.

Four checks say the model is behaving. The traced exit directions reproduce the geometric deviation exactly. The Airy peak sits 0.314 degrees inside the geometric rainbow angle for half millimetre drops, and that offset scales as the drop radius to the power of minus two thirds to three significant figures, which is the signature of a cubic caustic. The supernumerary maxima appear inside the main bow with shrinking spacing, as they should. And the secondary bow shifts 0.559 degrees the other way, outward, so both bows lean toward the dark band between them. That last one is a good check because nothing in the code was told about it.

One honest limit. Airy theory is an expansion about the rainbow ray, and it gets worse as drops get smaller. I use it for raindrop sizes, where it is reliable, and where I stretch it toward fog droplets later I say so.

The order, and the angles it lands on

Measuring outward from the antisolar point, which is the shadow of your own head, the primary bow lays its wavelengths out like this.

  • 400 nm, violet, at 40.567 degrees
  • 450 nm, blue, at 41.127
  • 500 nm, cyan, at 41.529
  • 550 nm, green, at 41.834
  • 600 nm, orange, at 42.075
  • 650 nm, red, at 42.272
  • 700 nm, deep red, at 42.440

Two things fall out of that list. The bow is 1.873 degrees wide in total, which is narrow. And the spacing is not even. The gap from 400 to 500 nm is 0.962 degrees, while the gap from 600 to 700 nm is only 0.365. The long wavelength end of a rainbow is compressed into less than half the sky that the short wavelength end gets, which is already a hint that the seven bands are not going to come out as seven equal stripes.

The secondary bow, which has one more bounce inside each drop, runs from 50.238 degrees for deep red to 53.620 for violet. Note the reversal: in the second bow red is on the inside. That is not a separate rule to memorise, it is what an extra reflection does to the geometry.

The sun is as wide as the gap from red to green

Here is the number that explains almost everything else on this page.

In the primary bow, the angular distance from 650 nm red to 532 nm green is 0.536 degrees. The sun’s disc is 0.533 degrees across. Those are the same number.

Every drop makes its own perfectly clean spectrum. But you are not looking at one drop lit by one point of light, you are looking at countless drops lit by a disc half a degree wide, and each point on that disc makes its own copy of the bow shifted slightly from the others. Stack them and every place in the bow receives light from a band of wavelengths spanning roughly red to green. The rainbow is blurred by the size of the light source that makes it, and the blur is the same width as a third of the bow.

This is why a rainbow can never look like a spectrum from a prism, no matter how good the rain is. It is not an atmospheric imperfection or a limit of your eyes. It is the sun being an object rather than a point.

What the bow actually renders

Here is the primary bow for half millimetre drops, walking outward. Each rung gives the color, its dominant wavelength, its excitation purity against the solar white point, and its brightness relative to the brightest point of the bow. Purity is the honest measure here: 100 percent is a pure spectral color, and 0 percent is white.

40.4°#FFF0E7 · 472 nm · 4.6% · 0.40
40.6°#FFEDFB · 464 nm · 11.1% · 0.44
41.0°#E7D3FF · 460 nm · 20.8% · 0.49
41.2°#A8FFCF · 501 nm · 15.4% · 0.60
41.4°#A7FF63 · 555 nm · 51.2% · 0.86
41.6°#FFF000 · 572 nm · 84.4% · 1.00
41.8°#FFA300 · 583 nm · 95.2% · 0.84
42.0°#FF7400 · 592 nm · 98.4% · 0.50
42.2°#FF5000 · 599 nm · 99.4% · 0.22
42.4°#FF2E00 · 604 nm · 99.7% · 0.08
42.6°#FF0000 · 609 nm · 99.8% · 0.02

That ladder is the whole article in eleven rows. The outer edge is very nearly a pure spectral color, and it is almost dark. The brightest point of the entire rainbow is a yellow at 41.6 degrees. And below about 41.4 degrees the purity falls off a cliff into a series of pale tints that never recover.

Excitation purity crosses 50 percent at 41.44 degrees. That splits the bow into two halves that behave completely differently. The outer part, 1.54 degrees of it, averages 57.8 percent purity and carries 46.7 percent of the light. The inner part, 1.22 degrees, averages 14.5 percent purity and carries the other 53.3 percent. More than half the light in a rainbow is in the part that is barely colored at all.

Where the seven named bands land

Take the conventional wavelength range for each of the seven names, find the angle its centre maps to, and read off what the sky puts there.

Red #FF3000
620 to 750 nm · 42.393° · 0.373° wide · 99.7% pure
Orange #FF6100
590 to 620 nm · 42.096° · 0.128° wide · 99.0% pure
Yellow #FF7800
570 to 590 nm · 41.985° · 0.094° wide · 98.3% pure
Green #FFB600
495 to 570 nm · 41.736° · 0.442° wide · 93.3% pure
Blue #90FF8C
450 to 495 nm · 41.323° · 0.367° wide · 29.9% pure
Indigo #E9CFFF
420 to 450 nm · 40.979° · 0.311° wide · 21.3% pure
Violet #FFEFF7
380 to 420 nm · 40.567° · 0.538° wide · 9.8% pure

Four of those seven swatches are not the color they are named after. The angle where green light peaks renders as an amber, because the sun’s disc drags red and orange into it from outside. The angle assigned to blue renders as a pale green. Indigo renders as a lavender and violet renders as very slightly pink white.

Green does exist in a rainbow, it just is not where the wavelength bookkeeping says. It shows up further in, around 41.2 to 41.4 degrees, and it is pale when it gets there. The named bands are a map of wavelengths, and what you see is a map of mixtures.

So is indigo real

People ask this because Newton chose seven colors partly by analogy with the seven note musical scale, and indigo has looked like the odd one out ever since. The measurement gives a more interesting answer than yes or no.

Indigo is not indistinguishable from its neighbours. At matched brightness it sits 42.9 CIEDE2000 units from the band called blue and 9.2 from the band called violet, and both of those are far above the roughly 2.3 unit threshold where a difference becomes visible at all. On that test indigo passes easily.

The real problem is that it passes the test in the wrong region. Indigo, blue and violet come in at 21.3, 29.9 and 9.8 percent purity. All three are pale tints. Arguing about whether indigo deserves a name alongside blue and violet is arguing about the boundary between three washed out colors that together occupy the least saturated third of the bow. The honest answer is that indigo is no less real than the rainbow’s blue, because the rainbow’s blue is barely blue either.

The rarest color in a rainbow

If rarest means occupying the least sky, the answer is yellow. The conventional yellow range from 570 to 590 nm maps to just 0.094 degrees of the bow. Orange gets 0.128. Violet, at the other extreme, gets 0.538, which is more than five times yellow’s share.

Yellow’s entire band is less than a fifth of the width of the sun. Since the sun blurs the bow by its own width, the yellow band is comprehensively smeared into its neighbours before it ever reaches you. Rainbow yellow is rare in exactly the sense that matters: there is no angle at which you see yellow uncontaminated by orange and green.

How many colors are actually in a rainbow

Walking across the main bow and counting every step of 2.3 CIEDE2000 units, which is roughly where a color difference becomes noticeable, gives 57 distinguishable colors on hue and saturation alone. Count brightness differences as well and it is 85. End to end the bow spans 67.0 units of color difference.

So the number of colors in a rainbow is not seven, and it is also not infinite, which is the other answer people give. It is a few dozen, set by how finely your eye can slice a 2.77 degree strip of sky. Seven undercounts it by roughly a factor of eight. Infinity overcounts it by ignoring that your eye has a resolution, which is the same point made at length in how many colors you can see.

The poster is a long way from the sky

Compare the seven rendered bands against the seven saturated swatches that get printed on classroom posters and used in rainbow color palettes. At matched brightness, so this is purely about hue and saturation:

  • Red, poster #FF0000 against measured #FF3000, off by 15.9
  • Orange, #FF7F00 against #FF6100, off by 8.6
  • Yellow, #FFFF00 against #FF7800, off by 34.8
  • Green, #00FF00 against #FFB600, off by 39.6
  • Blue, #0000FF against #90FF8C, off by 56.9
  • Indigo, #4B0082 against #E9CFFF, off by 25.5
  • Violet, #9400D3 against #FFEFF7, off by 28.5

The mean error is 30.0 CIEDE2000 units, against a threshold of about 2.3 for a just noticeable difference. The poster is not slightly stylised. Every single band is more than ten just noticeable differences from what the sky produces, and the blue is off by twenty five of them.

Only orange is close, and only because orange is the one band where the rainbow genuinely is a saturated pure color. The further toward violet you go, the more the poster is drawing a spectrum while the sky is drawing a wash.

The second bow, and the dark band between

The secondary bow spans 50.238 to 53.620 degrees, so it is 3.382 degrees wide, which is 1.8 times the width of the primary. The same amount of dispersion is spread over more sky, which is one reason it looks softer. It peaks at 13.4 percent of the primary’s brightness, having lost most of its light to a second internal reflection that leaks a large fraction of the beam out of the drop.

Between the two bows sits a gap 7.797 degrees wide where neither family of rays can send you anything. That is Alexander’s dark band, and it is genuinely darker than the sky on either side of it rather than looking that way by contrast. If you have ever noticed that the sky inside a rainbow looks brighter than the sky outside it, that is the same effect from the other direction: light piles up inside the primary and stops abruptly at its outer edge.

One more thing that falls out of the Fresnel bookkeeping. At the rainbow ray, light strikes the back of the drop at an internal angle of 40.11 degrees, and the internal Brewster angle for water is 36.84. Those are close enough that the reflection almost entirely rejects one polarisation. The light in a rainbow comes out 92.7 percent polarised. A rainbow is the most strongly polarised thing in an ordinary sky, and a polarising filter turned the wrong way will erase one almost completely.

When a rainbow stops having colors

Every wavelength gets its own Airy pattern, and the width of that pattern grows as drops get smaller. At some size each wavelength is smeared across more sky than separates red from violet, and once that happens the colors have no choice but to overlap into white.

  • 2 mm drops: each wavelength spans 0.200 degrees
  • 1 mm: 0.314
  • 0.5 mm: 0.500
  • 0.2 mm: 0.926
  • 0.1 mm: 1.478
  • 0.05 mm: 2.378
  • 0.01 mm: 7.622

The crossover, where a single wavelength covers the full 1.873 degrees from red to violet, lands at a drop radius of about 70 micrometres. Drizzle and rain sit comfortably above that. Cloud and fog droplets are typically 5 to 25 micrometres, which is an order of magnitude below it, and that is why a fogbow is a broad white arc rather than a small rainbow. It is the same physics losing an argument with the drop size.

This is also why big drops make the vivid rainbows. A heavy shower with millimetre drops gives each wavelength a fifth of a degree to itself. Fine drizzle spreads the same colors over five times more sky and washes them together.

Why your photo looks worse than the rainbow did

A rainbow is never seen on black. It is laid over whatever sky and cloud happens to be behind it, and that background adds neutral light to every part of the bow. Adding a flat neutral background at a given fraction of the bow’s own peak brightness does this:

  • No background: 67.0 units of color range, 61 distinguishable steps
  • Background at half the bow peak: 46.1 units, 49 steps
  • Background equal to the bow peak: 38.4 units, 40 steps
  • Background at four times the bow peak: 17.4 units, 20 steps

A bright sky behind the bow costs you most of its color. This is the practical reason rainbows look best against a dark storm cloud, and the reason a phone camera that exposes for the bright sky returns a disappointing photo of something that looked spectacular. The bow did not change. The ratio between the bow and its background did.

What I take from this

The order question has a clean answer and the sky honours it exactly: red outside, violet inside, reversed in the second bow, every time. The count question does not have a clean answer, and the seven band convention is a poor description of what is up there.

What struck me most is how much of the rainbow is not colorful. More than half its light sits in a region averaging 14.5 percent purity. The saturated part everyone pictures is the outer edge, and the outer edge is also the dimmest part, fading to two percent brightness by the time it is properly red. A rainbow is a bright pale arc with a thin vivid rim, and memory quietly upgrades it into a band of seven pure colors afterwards. That gap between what arrives and what you keep is the same one behind memory colors, where the remembered version of a familiar thing is reliably more saturated than the real one.

If you want to feel the size of a 2.3 unit difference for yourself, the pale end of the bow is the interesting place to look. Distinguishing #E7D3FF from #FFEDFB is exactly the kind of near neutral judgement that the color memory game is built around, and it is much harder than telling the reds apart. The gradient mode runs the same test along a smooth ramp, which is essentially what a rainbow is. Training your eye for color covers why the low saturation end is where people improve most.