max_chroma {colorspace} | R Documentation |
Compute approximately the maximum chroma possible for a given hue and luminance combination in the HCL color space.
max_chroma(h, l, floor = FALSE)
max_chroma_table
h |
hue value in the HCL color description, has to be in [0, 360]. |
l |
luminance value in the HCL color description, has to be in [0, 100]. |
floor |
logical. Should the chroma value be rounded down to the next lower integer? |
As the possible combinations of chroma and luminance depend on hue, it is
not obvious which maximum chroma can be used for a given combination of hue
and luminance prior to calling polarLUV
. To avoid having to
fixup
the color upon conversion to RGB hex
codes, the
max_chroma
function computes (approximately) the maximum chroma
possible. The computations are based on interpolations of pre-computed
maxima in max_chroma_table
, containing the maximum chroma for a given
hue-luminance combination (both in integers). Hence, the result may sometimes
still be very slightly larger than the actual maximum which can be avoided
by taking the floor
of the approximate value.
A numeric vector with the maximum chroma coordinates.
max_chroma(h = 0:36 * 10, l = 50)
max_chroma(h = 120, l = 0:10 * 10)