extract_hsl: Extract HSL components

View source: R/extract.R

clr_extract_hueR Documentation

Extract HSL components

Description

Extract the hue, saturation, or lightness color components from a vector of colors.

Usage

clr_extract_hue(col, space = c("HSL", "HCL"))

clr_extract_saturation(col)

clr_extract_lightness(col)

clr_extract_luminance(col)

Arguments

col

A colors object (see color()) or a vector of any of the three kinds of R color specifications, i.e., either a color name (as listed by grDevices::colors()), a hexadecimal string (see col2rgb()), or a positive integer i meaning grDevices::palette()⁠[i]⁠.

space

A character string specifying the color space where hue is extracted from. Can be either "HCL" or "HSL" (default).

Details

The range of the value are:

  • From 0 to 360 for hue. This in a circular fashion such that 0 and 360 are near identical. 0 is red.

  • From 0 to 100 for saturation where 100 is full saturation and 0 is no saturation.

  • From 0 to 100 for lightness where 100 is full lightness and 0 is no lightness.

Use clr_extract() if you are planning to extraction multiple components.

Value

Numeric vector of values.

See Also

Other Extraction: clr_extract(), clr_extract_chroma(), extract_rgba()

Examples

clr_extract_hue(rainbow(100), "HSL")
clr_extract_saturation(rainbow(100))
clr_extract_lightness(rainbow(100))

EmilHvitfeldt/prismatic documentation built on Nov. 23, 2024, 10:41 a.m.