Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

max_chroma

Compute Maximum Chroma for Given Hue and Luminance in HCL


Description

Compute approximately the maximum chroma possible for a given hue and luminance combination in the HCL color space.

Usage

max_chroma(h, l, floor = FALSE)

max_chroma_table

Arguments

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?

Details

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.

Value

A numeric vector with the maximum chroma coordinates.

See Also

Examples

max_chroma(h = 0:36 * 10, l = 50)
max_chroma(h = 120, l = 0:10 * 10)

colorspace

A Toolbox for Manipulating and Assessing Colors and Palettes

v2.0-1
BSD_3_clause + file LICENSE
Authors
Ross Ihaka [aut], Paul Murrell [aut] (<https://orcid.org/0000-0002-3224-8858>), Kurt Hornik [aut] (<https://orcid.org/0000-0003-4198-9911>), Jason C. Fisher [aut] (<https://orcid.org/0000-0001-9032-8912>), Reto Stauffer [aut] (<https://orcid.org/0000-0002-3798-5507>), Claus O. Wilke [aut] (<https://orcid.org/0000-0002-7470-9261>), Claire D. McWhite [aut] (<https://orcid.org/0000-0001-7346-3047>), Achim Zeileis [aut, cre] (<https://orcid.org/0000-0003-0918-3766>)
Initial release
2021-05-03

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.