Skip to contents

Set alpha in color

Usage

clr_alpha(col, alpha = 0.5)

Arguments

col

A colors object (see color()) or a vector of any of the three kinds of R color specifications, i.e., either a color name (as listed by grDevices::colors()), a hexadecimal string (see col2rgb()), or a positive integer i meaning grDevices::palette()[i].

alpha

Numeric between 0 and 1. 0 will result in full transparency and 1 in no transparency.

Value

A colors object of the same length as col.

Examples

plot(clr_alpha(rainbow(10), 0.5))


plot(clr_alpha(rainbow(10), 0.2))


plot(clr_alpha(rainbow(10), seq(0, 1, length.out = 10)))