visible | R Documentation |
Correspondence table between wavelengths of visible light and sRGB colors
visible
A data.frame with 77 rows and 2 variables:
the wavelength, in nm.
the hex code of the corresponding color.
As explained by the author, David Eccles: "Colour ranges were taken from 'CRC Handbook of Fundamental Spectroscopic Correlation Charts' (see https://en.wikipedia.org/wiki/Visible_spectrum). Spectral XYZ locus coordinates were found at http://www.cie.co.at/main/freepubs.html. Every 10nm, the spectral locus point was used as the initial point in a search for a matching sRGB colour (assuming "Dim" viewing condition). The search was carried out by a binary search along a line in JCh space between the spectral point, and a point with 0.3 * brightness (J), 0 chroma (C), and the same hue (h) as the spectral point. The search finished when a point was found that was in sRGB space. The CAT02 matrix was modified as suggested in Brill(2008) https://doi.org/10.1002/col.20432 to reduce yellow-blue problems by replacing the bottom row (0.0030, 0.0136, 0.9834) with (0,0,1). An iterative smoothing was carried out to eliminate the largest jumps in chroma (greater than 5% change). Code used to generate the colour gradient can be found at http://www.gringene.org/code/spectrum.r."
https://en.wikipedia.org/wiki/Visible_spectrum#/media/File:Linear_visible_spectrum.svg
wavelength
which uses the table to convert any wavelength value to an R color.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.