Colors of the Visible Spectrum

Initializing live version
Download to Desktop

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.

Accurate computer display of the color and RGB values of a particular wavelength of the visible spectrum is an application of both color and vision science and color display technology. The spectrum incorporates the falloff in sensitivity of vision toward the short and long wavelength limits. The appearance of the spectrum changes depending on the color space used because of the different primary colors and white point of each color space. Unless your display is fairly color accurate, note that the spectrum image may appear degraded by banding; on a color-accurate display, the gradation in the image is smooth.

Contributed by: Dan Dill (September 2011)
Open content licensed under CC BY-NC-SA



The CIE 1931 chromaticity diagram is the locus of chromaticity coordinates for each visible wavelength . The chromaticity coordinates of the color space primaries are the vertices of the triangular region that determines the gamut of colors that can be represented in the color space.

For each wavelength , the chromaticity coordinates on the boundary of the color space triangular region are found as the intersection of the dominant wavelength line with the gamut boundary. (This scheme ignores that lines of constant hue are not straight.)

The gamut boundary chromaticity coordinates are converted to XYZ tristimulus values normalized to the Judd–Vos modified CIE 2-degree photopic luminosity curve, , as follows: .

The normalized XYZ tristimulus values are converted to RGB values using the color space XYZ RGB transformation matrix, the resulting RGB values are scaled so that the maximum value is 1, and finally RGB values are scaled by the color space transfer function (gamma adjustment).

For accurate appearance in a color-managed environment, the color space profile must be assigned to the resulting spectrum, for example, in Adobe Photoshop using Edit / Assign Profile. It does not appear to be possible to assign color space profiles within Mathematica.


[1] Adobe System Incorporated, "Adobe RGB (1968) Color Image Encoding," Version 2005-05.

[2] A. T. Young, "Rendering Spectra." (Sep 22, 2011)

[3] A. T. Young, "What Color Is It?" (Sep 22, 2011)

[4] C. Poynton, "A Guided Tour of Color Space." (Jul 14, 2015)

[5] R. W. G. Hunt, Measuring Colour, 3rd ed., Kingston-upon-Thames, England: Fountain Press, 1998.

Feedback (field required)
Email (field required) Name
Occupation Organization
Note: Your message & contact information may be shared with the author of any specific Demonstration for which you give feedback.