Visualizing colors from a given spectrum
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.
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.
The right side shows the resulting color from this spectrum.
The right side shows the resulting color from this spectrum.
1
, ..., 9
, 0
: Set a spectrum that is emitted by a blackbody at temperature key
* 1000 Kelvin (10000 Kelvin for key 0
).r
, g
, b
: Set a spectrum with color red, green or blue.c
, m
, y
, k
: Set a spectrum with color cyan, magenta, yellow or black.+
, -
: Change the position of the spectrum.For more information view the code on GitHub!