col2alpha: Quickly add alpha transparency to a color

Description Usage Arguments See Also Examples

View source: R/col2alpha.R

Description

Function to return color value with transparency added

Usage

1
col2alpha(col, alpha = 0.5)

Arguments

col

Opaque color. Can be named ("red") or hexadecimal, as in what RColorBrewer returns.

alpha

Alpha transparency, where 1 is opaque and 0 is transparent. Defaults to 0.5.

See Also

col2rgb

Examples

1
2
3
## Demonstration with named color
plot(1:3,1:3, col=col2alpha("red",0.8), type="b", lwd=2)
lines(3:1,1:3, col=col2alpha("red",0.2), lwd=4)

lcomm/ltools documentation built on May 20, 2019, 11:28 p.m.