Converting Wavelengths to RGB color values

Visible light is essentially just a name for a very specific spectrum of electromagnetic radiation. The wavelengths that we can see with our eyes are between approx. 400 nm and 780 nm. UV light, which is invisible to us, begins at below 400 nm. The longer-wave infrared radiation starts at wavelengths greater than 780nm. Infrared light is not visible to our eyes, but our skin can perceive it as warmth.

Wavelength as RGB color

This visualization illustrates what a certain wavelength looks like as an RGB value. It should be noted that the RGB color space is significantly smaller than the space that our eyes can actually see. In other words: in the real world we can perceive colors that cannot be represented in RGB space.

RGB color value:

The algorithm is orginally from Dan Bruton and has been translated here for display in the browser.

Why are red, green and blue enough to represent so many colors?

This translation of wavelengths into RGB color hues works because it approximates the functionality of our eyes. There are only three different types of receptors on the retina, each roughly covering the range of red, green and blue:

This means we cannot see intermediate hues, especially yellow, directly. This color impression only arises in the further processing of the signals that the receptors send to our brain:

So we always perceive yellow when the receptors for green and red have been activated approximately equally by the incident radiation.

In the border regions below 420 and above 700 nm, we can only differentiate color tones very imprecisely, which is why these areas are displayed with a lower color intensity in the visualization.

Wavelengths of the rainbow colors

With the help of the visualization we can also determine the wavelengths of individual colors. The classic rainbow colors have roughly the following values:

Wavelength of violet light: approx. 400 nm, entire violet spectrum approx. 380-420 nm

Wavelength of blue light: approx. 440 nm, entire blue spectrum approx. 420–490 nm

Wavelength of green light: approx. 510 nm, entire green spectrum approx. 490–575 nm

Wavelength of yellow light: approx. 580 nm, entire yellow spectrum approx. 575–585 nm

Wavelength of orange light: approx. 610 nm, entire orange spectrum approx. 585–650 nm

Wavelength of red light: approx. 645 nm, entire red spectrum approx. 650–750 nm

The limits of the RGB color space

The RGB color space is well suited, for example, for comparing the quality of different screens with one another. However, it does not cover all the hues that our eyes can perceive. And for use in industrial color measurement, it has another disadvantage: From two different RGB color values it is not possible to read how far apart the color tones are from the numbers alone. However, this is of great importance for many manufacturing processes. This is a major reason for the development of the L*A*B* color space. For more information, see the following article on color scales and color spaces.