Apply color channel numeric range cap

apply_color_cap(x, channel = "l", range = c(0, 100), space = "hcl", ...)

Arguments

x

vector colors, or list of color vectors. When input is a list, the list is flattened, operations are performed, then the result is split back into the original structure.

channel

character channel recognized by farver::set_channel().

range

numeric range allowed for values returned by farver::get_channel().

space

character name of a color space recognized by farver::set_channel().

...

additional arguments are passed to farver::get_channel() and farver::set_channel().

Details

This function extends farver::set_channel() by enforcing a numeric range for any numeric channel accessible by the farver package. Common use is to restrict the luminance "l" channel of an "hcl" color from c(0,100) to c(70,100) in order to make all colors brighter.