See the Pen Wavelength to Colour Relationship (use Chroma.js) by Firegroove (@firegroove) on CodePen.39562

Color sensitivity of the human eye

In very low light levels, our vision is called “scotopic” Light is detected by rod-shaped cells of our retina. Rods are maximally sensitive to wavelengths near 500 nm, and play little -if any- role in human colour vision. However, in brighter light, such as daylight, vision is called “photopic”: light is detected by cone-shaped cells which are responsible for human colour vision. Cones are sensitive to a range of wavelengths, but are most sensitive to wavelengths near 555 nm.

Relative brightness sensitivity of the human visual system as a function of wavelength

Conventionally ,cones are labeled according to the ordering of the wavelengths peaks of their spectral sensitivities: short (S), medium (M), and long (L) cone types. These three types do not correspond well to particular colors as we know them!

Rather, the perception of color is achieved by a complex process that starts with the differential output of these cells in the retina and it will be finalized in the visual cortex and associative areas of the brain.

Normalized response spectra of human photo-sensitive cones, to monochromatic spectral stimuli, with wavelength given in nanometers