Skip to contents

Calculates rgb values from spectra based on human color matching functions

Usage

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

Arguments

w.length

numeric vector of wavelengths (nm) of length 2. If longer, its range is used.

sens

chroma_spct Used as the chromaticity definition.

color.name

character Used for naming the rgb color definition(s) returned.

Value

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

See also

Other color functions: rgb_spct(), w_length2rgb()

Examples

col2rgb(w_length_range2rgb(c(500,600)))
#>       500-600 nm
#> red           95
#> green        255
#> blue           0
col2rgb(w_length_range2rgb(550))
#> Calculating RGB values for monochromatic light.
#>       wl.550.nm
#> red           0
#> green       255
#> blue          0
col2rgb(w_length_range2rgb(500:600))
#> Using only extreme wavelength values.
#>       500-600 nm
#> red           95
#> green        255
#> blue           0