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 color object or vector of any of the three kinds of R color specifications, i.e., either a color name (as listed by colors()), a hexadecimal string of the form "#rrggbb" or "#rrggbbaa" (see rgb), or a positive integer i meaning palette()[i].

components

character, 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

This function is to be preferred if you need to extract multiple components at the same time, since it doesn't need repeat transformations.

Value

data.frame of components

See Also

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

Examples

clr_extract(rainbow(10))

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

prismatic documentation built on May 29, 2024, 6:04 a.m.