R/FSAUtils.R
col2rgbt.Rd
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.
col2rgbt(col, transp = 1)
col | A vector of any of the three kinds of R color specifications (i.e., either a color name (as listed by |
---|---|
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. |
A vector of hexadecimal strings of the form "#rrggbbaa" as would be returned by rgb
.
See col2rgb
for similar functionality.
col2rgbt("black")#> [1] "#000000FF"col2rgbt("black",1/4)#> [1] "#00000040"clrs <- c("black","blue","red","green") col2rgbt(clrs)#> [1] "#000000FF" "#0000FFFF" "#FF0000FF" "#00FF00FF"col2rgbt(clrs,1/4)#> [1] "#00000040" "#0000FF40" "#FF000040" "#00FF0040"trans <- (1:4)/5 col2rgbt(clrs,trans)#> [1] "#00000033" "#0000FF66" "#FF000099" "#00FF00CC"