Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

col2rgbt

Converts an R color to RGB (red/green/blue) including a transparency (alpha channel).


Description

Converts an R color to RGB (red/green/blue) including a transparency (alpha channel). Similar to col2rgb except that a transparency (alpha channel) can be included.

Usage

col2rgbt(col, transp = 1)

Arguments

col

A 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].

transp

A numeric vector that indicates the transparency level for the color. The transparency values must be greater than 0. Transparency values greater than 1 are interpreted as the number of points plotted on top of each other before the transparency is lost and is, thus, transformed to the inverse of the transparency value provided.

Value

A vector of hexadecimal strings of the form "#rrggbbaa" as would be returned by rgb.

Author(s)

Derek H. Ogle, derek@derekogle.com

See Also

See col2rgb for similar functionality.

Examples

col2rgbt("black")
col2rgbt("black",1/4)
clrs <- c("black","blue","red","green")
col2rgbt(clrs)
col2rgbt(clrs,1/4)
trans <- (1:4)/5
col2rgbt(clrs,trans)

FSA

Simple Fisheries Stock Assessment Methods

v0.8.32
GPL (>= 2)
Authors
Derek Ogle [aut, cre] (<https://orcid.org/0000-0002-0370-9299>), Powell Wheeler [aut], Alexis Dinno [aut] (Provided base functionality of dunnTest())
Initial release
2021-1-15

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.