Wavelength to Colour Relationship


A simple tool to convert a wavelength in nm to an RGB, hexadecimal or HSL colour.

Physics Light Colour




Over the course of millions of years, the human eye has evolved to detect light in the range 380—780nm, a portion of the electromagnetic spectrum known as visible light, which we perceive as colour. The particular range of wavelengths coincides with a window in the Earth's atmosphere, through which this light can travel. Higher frequency radiation, such as x-rays are absorbed by the atmosphere, as are lower frequencies, such as microwaves.

Sunlight appears white to us because it emits almost uniformly over all visible frequencies. However, a laser for example, emits only at a single very specific frequency. Helium-neon lasers emit at 632.8nm, which is a bright red. The lasers in your Blu-ray player emit at 405nm, which as the name suggests, is blue. We can begin to build up a picture of how frequency is related to colour.

A frequent way of referring to colour on computer screens is by using the RGB system. In this model, each colour is given a value for each red, green and blues components ranging from 0 to 255, giving a total value of 16.7 million possible colours. However, due to the very complex way in which the eye perceives colours, we can see colours which are outside of the gamut of the RGB scheme - there is no unique mapping that definitively converts a wavelength to a colour, and as such the above tool should been seen as more of an approximation than a rigorous resource.

This demo was utilised in the paper Teaching Beer’s Law and Absorption Spectrophotometry with a Smart Phone: A Substantially Simplified Protocol by Thomas S. Kuntzleman and Erik C. Jacobson.


Credits

  • The code used to generate the colours is based on the work of Dan Bruton.

If you've found this educational demo helpful, please consider supporting us on Ko-fi.