clr_extract: Extract multiple components

View source: R/extract.R

clr_extractR Documentation

Extract multiple components

Description

Extract multiple color components at the same time.

Usage

clr_extract(
  col,
  components = c("red", "green", "blue", "hue_hsl", "saturation", "lightness", "hue_hcl",
    "chroma", "luminance")
)

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]⁠.

components

A character vector of components that should be extracted. See Details for allowed components.

Details

The allowed values for components are:

  • red

  • green

  • blue

  • hue_hsl

  • saturation

  • lightness

  • hue_hcl

  • chroma

  • luminance

clr_extract() is to be preferred over other extraction functions if you need to extract multiple components at the same time, since it doesn't repeat transformations.

Value

A data.frame of components.

See Also

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

Examples

clr_extract(rainbow(10))

clr_extract(rainbow(10), c("hue_hsl", "saturation"))

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