rgb
Convert numeric color values to character color codes

Description

Converts the numeric values for red, green, blue, and alpha to "#RRGGBBAA" color strings.

Usage

rgb(red, green, blue, alpha = NULL, names = NULL, maxColorValue = 1)

Arguments

red numbers between 0 and maxColorValue giving the amount of redness in the colors.

If red is a 3-column matrix or data.frame and the green and blue arguments are omitted, then its columns will be used as the usual red, green, and blue arguments.

green numbers between 0 and maxColorValue giving the amount of greenness in the colors.
blue numbers between 0 and maxColorValue giving the amount of blueness in the colors.
alpha numbers between 0 and maxColorValue giving the amount of opacity in the colors. If NULL, the default, the colors will be fully opaque.
names a character vector (or NULL) giving the names for the output vector.
maxColorValue a positive number giving the scale for the color and alpha values.
Value
returns a character vector of color codes of the form "#RRGGBB" or "#RRGGBBAA", giving 2-hexadecimal-digit values for each color component (and possibly opacity). You can use these color codes instead of predefined colors like "red" or "black" in calls to graphics functions.
See Also
col2rgb converts predefined color names to red/green/blue values.
Examples
rgb(red=c(1,.8), green=c(0,.8), blue=c(0,0), alpha=.4, names=c("redTint", "yellowTint"))
rgb(cbind(c(1,.8), c(0,.8), c(0,0)), alpha=.4, names=c("redTint", "yellowTint"))
Package grDevices version 6.0.0-69
Package Index