Get Color Names and Values

DESCRIPTION:

Get the names and RGB hex string values for the known named colors.

USAGE:

colors()
color.values(x = NULL)

OPTIONAL ARGUMENTS:

x
Character vector of color names. If NULL, all colors are returned.

VALUE:

colors returns an unnamed character vector containing the known color names such as "red". color.values returns a named character vector, where the names are the color names and the elements are RGB values such as "#FF0000" or "#FF000080". The seven-character description specifies the red, green, and blue values in the range 0 to 255 in hex notation. The nine-character description includes the "alpha" value for semi-transparent or transparent colors. If "alpha" is not included, the color is fully opaque with alpha of 255, i.e., "FF" in hex.

SIDE EFFECTS:

None

SEE ALSO:

.

EXAMPLES:

# Get the color names
colors()

# Get the RGB values for all named colors
color.values()

# Get the RGB values for specific colors
color.values(c("red", "teal"))