Skip to contents

Calculates rgb values from spectra based on human color matching functions

Usage

w_length2rgb(w.length, sens = photobiology::ciexyzCMF2.spct, color.name = NULL)

Arguments

w.length

numeric Vector of wavelengths [\(nm\)].

sens

chroma_spct Used as chromaticity definition.

color.name

character Used for naming the rgb color definition.

Value

A vector of colors defined using rgb(). The numeric values of the RGB components can be obtained using function col2rgb().

See also

Other color functions: rgb_spct(), w_length_range2rgb()

Examples

col2rgb(w_length2rgb(580))
#>       wl.580.nm
#> red         255
#> green       191
#> blue          0
col2rgb(w_length2rgb(c(400, 500, 600, 700)))
#>       wl.400.nm wl.500.nm wl.600.nm wl.700.nm
#> red           3         0       255         7
#> green         0       169        46         0
#> blue         30        46         0         0
col2rgb(w_length2rgb(c(400, 500, 600, 700), color.name=c("a","b","c","d")))
#>        a   b   c d
#> red    3   0 255 7
#> green  0 169  46 0
#> blue  30  46   0 0
col2rgb(w_length2rgb(c(400, 500, 600, 700), color.name="a"))
#>        a   a   a a
#> red    3   0 255 7
#> green  0 169  46 0
#> blue  30  46   0 0