extract_rgba: Extract RGB components

View source: R/extract.R

extract_rgbaR Documentation

Extract RGB components

Description

Extract the red, green, or blue color components from a vector of colors.

Usage

clr_extract_red(col)

clr_extract_green(col)

clr_extract_blue(col)

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

Details

The values of the output will range between 0 and 255.

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

Value

A numeric vector giving the extracted values.

See Also

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

Examples

clr_extract_red(rainbow(100))
clr_extract_green(rainbow(100))
clr_extract_blue(rainbow(100))
clr_extract_alpha(rainbow(100))

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