Creates a function that defines hue in terms of luminance.

surface_hl(range_hue, input_lum = c(0, 100))

Arguments

range_hue

numeric vector, length 1 or 2, specifies the hue at the luminance values specified in input_lum. If only one hue is specified, this will return a function for constant hue.

input_lum

numeric vector, length 2, specifies the luminance values corresponding to range_hue.

Value

function that takes luminance values, returns hue values.

Details

The range_hue you specify need not be between 0 and 360 - in fact you might not want them to be if you want to define a surface that crosses the hue branch-cut. The surface function will return hue values between 0 and 360.

Examples

  # single hue
  sfc_blues_single <- surface_hl(250)
  sfc_blues_single(c(0, 50, 100))
#> [1] 250 250 250

  # multi hue
  sfc_blues_multi <- surface_hl(c(240, 260))
  sfc_blues_multi(c(0, 50, 100))
#> [1] 240 250 260