Color Spectrum Testcase

A small utility program in Python (pygame + numpy) to visualize the connection between spectrum and colors, executed in browser using pyodide. The conversion from spectrum to color is taken from this Blogpost that is also a very nice explanation on the subject.

Try it out!

The left side shows a spectrum from 380 nm to 781 nm wave length with a 5 nm step.

The right side shows the resulting color from this spectrum.

Changing the spectrum

To change the spectrum just click on it and move the cursor around.

There are also some predefined spectrums that can be set by pressing the following keys:

Using filters

The shown spectrum can be filtered by a filter. To activate the filter press f.

All keys that modify the spectrum can also modify the filter in the same way by holding shift at the same time.

Normalizing colors

By default, the color on the right side and the colors of the spectrum are not normalized. To toggle the normalization of the spectrum press N. To toggle the normalization of the color on the right side press n.