6.6.1 Color representations of the electromagnetic spectrum

Two functions, in the colors module, provide color objects which approximate the color of particular wavelengths of light, or of electromagnetic spectra.

colors.wavelength($\lambda $,$norm$)
The colors.wavelength($\lambda $,$norm$) function returns a color representation of monochromatic light at wavelength $\lambda $, normalised to brightness $norm$. A value of $norm=1$ is recommended for plotting the complete span of the electromagnetic spectrum without colors clipping to white.

The colors.spectrum($spec,norm$) function returns a color representation of the spectrum $spec$, normalised to brightness $norm$. $spec$ should be a function object that takes a single input (wavelength) with units of length, and may return an output with arbitrary units.

For an example of the use of these functions, see Section 8.12.