# RGB Color Spaces: All the Colors, Some of the Colors, the Colors of Daylight

What goes into a matrix RGB color space? The ubiquitous sRGB color space will serve as our specimen color space. Pictures are used to illustrate xyY space, chromaticity coordinates, D# white points, and the meaning of "Red", "Green", and "Blue".

Written October 2012.

## What's that funny horseshoe thing? It's all the colors in the world

Let's take a look at that brightly-colored horseshoe-shaped thing you've undoubtedly seen before. That horseshoe is actually a picture of all the colors that the average human can see, displayed in the xyY color space:

### All the colors you can see

The colorful horseshoe shape, doesn't really show all the colors you can see. It's more like a "footprint" of all the colors that the average human can see, because it's actually just the xy plane of the three-dimensional xyY color space. Just like CieLAB, xyY is a reference color space — a mathematical model of all the colors the average person can see. Also just like CieLAB, xyY is mathematically derived from the 1931 CIE XYZ color space.

### Wavelengths of light

The numbers around the outside edge of the horseshoe indicate different wavelengths of visible light. The reddest red a human can see is at the right-side base of the horseshoe near the "700" mark (which means light with a wavelength of 700 nanometers, if you are curious). Similarly, the bluest blue a human can see is at the other side of the base, between the "460" and "380" marks. And the greenest green a human can see is up at the top, near the "520" mark.

### The color purple

The funny straight line at the bottom of the horseshoe connecting the blues and the reds is a reflection of the fact that there aren't any "purple" or "magenta" lightwaves. The longest wavelengths we can see are red, at 700nm. The shortest wavelengths we can see are blue-violet, at 380nm. Everything along the straight line connecting red and blue-violet is a construct of the human eye-and-brain that happens when we see a mix of blue and red light. The colors along the funny straight line illustrate beautifully that color isn't really "out there in the world". Lightwaves of varying lengths are "out there in the world". But all the beautiful colors of the world happen in the human eye and brain (which is why dogs and birds, for example, see the world differently than humans — different eyes and brains interpret lightwaves differently).

### The xy projection

See the the "x" along the x-axis and the "y" along the y-axis? The horseshoe is the xy projection of "all the colors" inside the 3-dimensional xyY color space. (Instead of x, y, and z axes like in high school algebra, you have x, y, and Y axes in the xyY color space.) The third dimension in the xyY color space is "Y", but you can't see "Y" in the two-dimensional graph because this xy projection is looking straight down the Y-axis.

So what are x, y, and Y? Y represents luminance (in non-technical terms, how bright it is, relatively speaking) and only takes positive values. As you might expect, when Y=0, the resulting color is black. x and y indicate chromaticity ("color", but with luminance mathematically abstracted away). x and y are allowed to take on negative values to accomodate things like camera input profiles, even though the horseshoe pictured above doesn't show any negative values.

## sRGB: Only some of the Colors

What, exactly, is "sRGB"? Below is the horseshoe-shaped xy-projection of "all the colors", but this time with a triangle indicating the location of the sRGB color space inside xyY space.

### Red, Green, and Blue

Inside the above horseshoe representation of all the colors we can see in the real world, are three small circles connected by three lines to form a triangle. These three small circles indicate the most saturated and pure red, blue and green colors that are possible within the sRGB color space.

Any color represented by a point inside the horseshoe, but outside the triangle formed by the three small circles, is a real-world color that isn't contained within the sRGB color space. Which explains why all the greens outside the sRGB triangle look like a giant blob of green, and likewise for the blues, reds, cyans, etc, that lie outside the triangle. (See the image creator's description of the horseshoe image for technical details.)

All the real-world colors that are outside the sRGB triangle can't be seen on an sRGB monitor, nor printed with an sRGB printer. The color space defined by the typical camera input profile holds a lot of colors that fall outside the triangle connecting the sRGB chromaticity coordinates. When you process a raw file (or your camera creates an sRGB image file for you), any colors in the resulting image file that are not contained within the sRGB color gamut are thrown away or modified to fit within sRGB.

### Chromaticity coordinates

From the horseshoe graph you can read the approximate "x" (horizontal axis) and "y" (vertical axis) values for each of the little circles. For example, the red sRGB circle (the circle nearest the "700" mark) is located at approximately x=0.65 and y= 0.33.

Those "xy" values are called "chromaticity coordinates". "Chroma" means "color"; the circles are located at particular coordinates on the graph; hence, "chromaticity coordinates". If you add in the Y value for each of the sRGB chromaticity coordinates, you can calculate the location of the sRGB primaries in the XYZ color space.

### Why not all the colors? Why is sRGB so small?

Every commonly used working space, be it the very large ProPhotoRGB, the mid-sized BetaRGB, or the very small sRGB, has chromaticity coordinates that determine how many colors it contains. And there is always a reason why the creator of a color space chose one set of chromaticity coordinates instead of some other set of chromaticity coordinates.

The sRGB chromaticity coordinates, weren't just randomly picked out of thin air. To understand them, you need a little history and also some hand-waving at technical details beyond my understanding and presumably yours. So here goes:

#### The ideal monitor — almost all the colors

Making colors on a monitor display requires at least three differently colored light sources. Ideally you'd want a red light, a blue light, and green light with respectively the same wavelengths as the reddest red, greenest green, and bluest blue the average human eye can see. Also, ideally you'd want these three light sources to be "spectrally pure", meaning each light source only emits one wavelength of light.

The position of the ideal lights on the horseshoe graph would be at the very edges of the horseshoe. The red light would be at the 700 nanometers mark, the green light would be at the the 520 nanometers mark, and the blue light would be somewhere between the 460 and 380 nanometer marks. So just like with the sRGB color space, each of these ideal red, green, and blue lights would have chromaticity coordinates. For example, reading off the graph itself, you can see that the ideal red light chromaticity coordinates would be roughly x=0.73 and y=0.27.

These three ideal light sources together could be mixed and matched to produce most, but not all the colors in the horseshoe. Why couldn't these ideal light sources produce all the colors in the horseshoe? Because they could only produce colors that are enclosed in the triangle you would get by connecting the chromaticity coordinates of these ideal light sources with straight lines (just like the sRGB color gamut is limited to what's inside the sRGB triangle).

If you examine the horseshoe for a minute, you'll convince yourself that there just aren't three points, inside or on the edges of the horseshoe itself, that can be connected by straight lines that would enclose all the colors in the horseshoe. (Adding a fourth light source, which some monitor displays have done recently, would allow for more complete coverage.)

#### Real monitors — not even close to all the colors

In the real world, to make real monitor displays, you have to deal not only with what is theoretically possible and ideally desirable, but also with what can be manufactured at a price-point that people can afford to buy.

Real world monitor displays mostly use light sources called phosphors. Different phosphors emit different colors of lights, but those colors are a long, long way from the colors of ideal monitor light sources.

#### CRT monitors and the sRGB color space

Hewlett-Packard and Microsoft created the sRGB color space in 1996 because they wanted an RGB working space that reflected the display characteristics of CRT monitors. The sRGB chromaticity coordinates are based on the chromaticity coordinates of the phosphors that were used to make CRT monitors back in the 1990s (long before consumer-level LCD monitors that were good enough for image editing made their appearance). And that is why sRGB only includes a small portion of "all the colors". (Unfortunately, even today's wide-gamut LCDs can't show all the colors.)

The story behind why Hewlett-Packard and Microsoft created the sRGB color space is interesting. The short version is that sRGB was proposed as a way to reduce interoperability problems caused by color management deficiencies in hardware and software back in the 1990s.

## The Colors of Daylight

### What's that fourth circle labelled "D65" doing in the middle of the sRGB triangle?

It probably didn't escape your notice that I haven't mentioned the fourth circle in the middle of the sRGB triangle. But in case you didn't see the fourth circle, here it is again:

That fourth circle in the middle of the sRGB triangle represents the "white point" or "color temperature" of the sRGB color space. The white point is labelled "D65", which stands for "Daylight at a temperature of 6500 degrees Kelvin". "Daylight" refers to the color of daylight, not the brightness!

If the idea of "white light" having a color seems counter-intuitive, take a piece of white paper outside on a bright, sunny day and stand where half of the paper is in deep shade, the other half in direct sunlight. Now doesn't the half of the paper in the deep shade look blue, compared to the half in full sun?

"D65" is a mathematical representation of the color of natural daylight on a sunny day - it's close to the real thing, but more convenient, because the real thing (real daylight) varies considerably over time and space, depending on the weather, time of year, air pollution and a whole host of other factors. D65 isn't the color of direct sunlight, but rather like daylight on a slightly overcast day. D70-D80 (and higher) is like the color of light when you are standing in the shade on a sunny day (the brighter and sunnier the day, the higher the color temperature is in the shade). Direct sunlight on a bright sunny day at noon is closer to D52. Direct sunlight on a sunny day in the early morning and late afternoon gets down to around D48 (and lower).

### How monitors make the color white (and whites of different colors)

"White" on a CRT monitor is made by mixing red, blue and green light from the red, blue, and green phosphors. Newer display technologies use other ways to make "white", for example LCD monitors have red, green, and blue "subpixels" in the screen itself, to which varying voltages are applied. The brightest "white" a monitor can display — which might in fact have a slight color cast — is when all three light colors are beaming at your eyeballs at full strength. On the old CRT monitors there were presets to avoid color casts; one preset, the brightest preset, had a color temperature of around 9300K, which is quite a bit on the blue side, like the color of light in deep shadow on a sunny day, rather than the "D65" color of light in direct daylight on a slightly overcast day.

Just as real daylight varies in color temperature, so also the whitest white a monitor can display can be set to different color temperatures, by adjusting respective amounts of the red, blue, and green (and/or other colors depending on the particular display technology) light that is used to make white.

The most important thing to remember about these "D" numbers is that as the numbers get lower, the "color of white" gets warmer and more yellow; conversely, as the numbers get higher, the "color of white" gets cooler and more blue.

### Why sRGB has D65 as the color of white

In CRT monitors the relative amounts of light coming from each phosphor can be easily adjusted to make "white" with color temperatures ranging from the eye-blasting and bluish 9300K all the way down to 5000K and even lower (5000K starts to look a little dingy, dim, and yellow). The D65 "color of white" was proposed as a standard for monitors used in image editing, way back in 1996, because it seemed like a good compromise between the brightest but bluish light you get at 9300K and the dimmer, more yellowish light you get at 5000K. So just as sRGB has the chromaticity coordinates of the phosphors that were used to make CRT monitors back in the 1990s, sRGB also has the D65 white point (which by the way, is still a widely used value for monitor calibration. And now you know why the sRGB "color of white" is 6500K, or rather D65.