R/wavelength2hex.R

Defines functions wavelength2hex

Documented in wavelength2hex

#' Turn a wavelength (in nm) in to a hex colour value.
#'
#' Converts a wavelength to a hex value, via RGB.
#'
#' @param wavelength a numerical wavelength to convert to hex.
#'
#' @return a hex representation of the wavelength.
#' @export
wavelength2hex <- function(wavelength){
  RGB <- wavelength2RGB(wavelength)
  hex <- grDevices::rgb(RGB[1], RGB[2], RGB[3], maxColorValue = 255)
  return(hex)
}
ucl-cssb/wavelength2colour documentation built on May 3, 2019, 2:22 p.m.