col2rgb
Interpret Color Names, Strings, and Numbers

Description

Converts color names, color strings of the form "#RRGGBB", and indices into the current palette of red/green/blue values.

Usage

col2rgb(col, alpha = FALSE)

Arguments

col a vector of character strings or of small positive integers.
  • The character strings should be either one of the names in the output of colors(), or strings of the form "0xRRGGBB" or "0xRRGGBBAA", giving the two-digit hexadecimal values (range 00-FF, equivalent to 0-255 decimal) of the red, green, blue, and possible alpha (opacity) values for the colors.
  • The integers should be indices into the list of colors listed in the output of palette().
alpha A logical value. If TRUE, the alpha (opacity) channel is returned. The default is FALSE.
Value
returns a three (or four, if alpha is TRUE) row matrix giving the red, green, blue, and possible alpha components of the input colors. The values are on a scale of 0 to 255.
See Also
rgb, rgb2hsv, adjustcolor.
Examples
col2rgb(c("red", "#10fe60"))
col2rgb(c("yellow", "#f0fe608f"), alpha=TRUE)
Package grDevices version 6.0.0-69
Package Index