Sixteen million colours, and the ceiling at seventy-four per cent
A screen is sold with two numbers on the box: 16.7 million colours, and a percentage of the visible spectrum. Both are rebuilt here from the 1931 colour-matching functions, and both come apart in the hand. Your eye answers every spectrum with three numbers, so 78 dimensions of the light are invisible to it by construction. No three primaries — not lasers, not anything — can cover more than 73.9% of the chromaticity diagram, ever. And the count of colours you can tell apart is a threshold you pick, cubed.
1 · the eye is a three-number instrument
Light arriving at your eye is a function of wavelength: at 5 nm steps from 380 to 780 nm that is 81 numbers, and in truth a continuum. Three cone classes integrate it against three curves, and everything you will ever know about that light is the three integrals. The curves plotted are the CIE colour-matching functions — a non-singular mixture of the cone responses, tabulated in 1931 and still the definition of what a colour is for every camera, screen and paint chip made since.
The last tile is a check on the table rather than on the eye. The 1931 functions were normalised so that a spectrum which is flat — equal power at every wavelength in the table — lands exactly at the centre of the diagram. It does not, quite: the three tabulated integrals differ in the fifth decimal, so the flat spectrum misses the centre by —. Nothing downstream cares, but it is the first sign that this is a table of measurements and not a set of axioms.
2 · seventy-eight dimensions you cannot see
Two spectra, drawn above, with identical X, Y and Z. Not close — identical to the last bit the arithmetic holds. The swatches under them are what your screen makes of each, and there is nothing to see, because there is nothing to see. Subtracting the two leaves a function of wavelength that the three curves integrate to zero, and the space of such functions has 76 dimensions on this grid. Colour is a projection, and a projection has a kernel.
Then move the observer. The same pair, put through the 1964 10° functions — the same eye, a wider patch of retina, measured on ten people rather than seventeen — separates by —, and one to two units is a difference you would argue about at a paint counter. This is not a curiosity. It is why two calibrated displays showing the same file, measured identical by the same meter, can look plainly different to two people standing in front of them: the meter is a fourth observer, and a match is only ever a match for one set of curves.
3 · the horseshoe, and the triangles inside it
Every physical light is a positive amount of monochromatic lights, so every colour that exists sits inside the convex hull of the spectral locus — the horseshoe. A display with three primaries can make exactly the triangle they span, and nothing else, because mixing is a positive combination and a positive combination cannot leave the hull of what you are mixing. The straight bottom edge of the horseshoe is not a spectrum at all: it is the chord joining 380 nm to 700 nm, and every colour on it — every magenta, every purple — is a mixture with no wavelength. That chord subtends — of the hue circle around white: — of the hues you can name are not in the rainbow.
Four percentages get printed for these gamuts, side by side, as though they were one
measurement:
One row of that table is doing something else. ProPhoto RGB covers more of the diagram than any three real primaries could, because two of its three primaries are outside the horseshoe: they are not colours, they are bookkeeping. Its triangle has — of its area over ground where no light can go, and — of its sixteen million code values name a chromaticity that does not exist. That is a legitimate trade — an encoding wide enough to hold any real colour must overshoot — but it is why the coverage column here clips every triangle to the hull first. A percentage of the visible ought to count only the visible.
Two smaller things fell out of drawing that curve. Interpolating the 5 nm table linearly to 1 nm adds precisely zero area — not nearly zero, zero — because chromaticity is a projective map, projective maps take straight lines to straight lines, and the new points land on the chords they were supposed to round off. Four-point interpolation curves properly and recovers — more area. And the horseshoe is not quite convex: — of the 321 tabulated points lie inside the hull of their neighbours, by up to —. Physics says the region must be convex; the 1931 committee's seventeen observers say it is convex to about four decimal places, and the standard has kept their arithmetic ever since.
4 · the ceiling no display can reach
Given k primaries, the best you can do is the largest k-gon that fits inside the horseshoe, and its corners must be pure wavelengths, because those are the only extreme points the hull has — this is a statement about real primaries, and the one gamut above that beats it does so with primaries that are not lights. That is a solved problem — one pass of dynamic programming over the locus — and the answer for k = 3 is — of the diagram, at —. Perfect lasers. Free choice of wavelength. No cost, no efficiency, no standard to obey. Still a quarter of the diagram out of reach, and it stays out of reach for the same reason a triangle cannot be a circle.
The table is the whole argument against 100% of the visible spectrum as a target. It is not a hard target; it is an unreachable one, approached like a limit and never touched — you would need every wavelength as its own primary. Rec.2020 already sits at — of everything three primaries can ever do, and it buys the last of that by putting its corners on the locus: its red, green and blue are 630, 532 and 467 nm monochromatic, which is a specification for three lasers written into a broadcast standard.
5 · what sixteen million is a count of
There is no such thing as the number of distinguishable colours. Fill the sRGB solid with
cells of radius ΔE₀₀ = s/2 and you get a count proportional to
1/s³, so every factor of two you argue about in the threshold moves the answer
by eight. At s = 1, the industrial tolerance, the answer is —. At
s = 0.5 it is — — which is where the familiar
2.3 million in the literature sits. The box's 16.7 million is not a count of
colours at all; it is a count of codes, and it corresponds to a threshold of
—, four times finer than the tolerance the paint industry works to.
And in the one place where the codes are laid out along a line — the grey ramp — 256 of them add up to — ΔE₀₀ end to end. If a unit is a just-noticeable difference, then there are about — distinguishable greys, and the other four fifths of the ramp are spare. Yet turn the bit depth down and you see the steps immediately. Both are true, and they are not in conflict: an isolated patch needs a whole unit to be told from its neighbour, and a smooth gradient gives the edge away at a fraction of one, because the eye is a differentiator and a straight edge across a soft ramp is the easiest thing in the world for it to find.
6 · the constants that look arbitrary and are not
0.2126 R + 0.7152 G + 0.0722 B is in every image library on earth, and it looks
like a fitted constant. It is not fitted to anything. Write down the three primaries of
sRGB and its white point — six numbers, all of them definitions — and solve the 3×3 system
that scales the primaries so they add to that white, and the middle row of the answer is
those coefficients, to every digit anyone publishes. Do the same with the 1953 NTSC
primaries, which no television has used since about 1970, and out falls
0.299 / 0.587 / 0.114 — the other triple, still in every video codec, still
describing a phosphor nobody has seen in fifty years.
The last two tiles are the cheapest bug in graphics. Mid-grey 128,128,128 is
not half as bright as white; it emits — of white's light, because the
code is a compressed encoding and not a quantity of anything. Resize an image, blend two
pixels, or fade to black without undoing that curve first and you have averaged the
encodings rather than the light — which is why naively downscaled images go dark, and why
a red-on-green gradient goes through mud.
7 · what this page cannot show you
The horseshoe above is drawn on your screen, which means every colour in it was made from three sRGB primaries, which means the picture is a lie exactly where it matters most — in the — of the diagram that sRGB cannot reach. Above, the same diagram with the unreachable region shown as what it actually is: the nearest colour the display could manage, and how far away that is. Of the — monochromatic wavelengths in the 1931 table between 380 and 700 nm, the number your screen can render is 0. Not few. None. Every pure wavelength needs a negative amount of one primary, which is the same discovery Wright and Guild made in the 1920s when they had to add light to the reference side of the field to get a match, and wrote it down as a minus sign.
Which leaves the last number on the box. 16.7 million colours is true, in the sense
that 2²⁴ is 16 777 216 and the display does accept all of them. It is a count
of the words in the language, not of the things that can be said in it — and the things
that can be said are bounded by a triangle whose corners were chosen in 1996 to match the
phosphors of a cathode-ray tube.
8 · what this page checked while you read it
Every one of these is an identity the arithmetic must satisfy, tested against a route the
page does not otherwise use. They run on load; if one turns red, the number above it is
wrong and the page is telling on itself. The companion file
tests/test_colour.py argues with the same numbers from outside, in Python,
including against the eight published CIEDE2000 test pairs.