coloralpha: add alpha to colours

Description Usage Arguments Value Examples

View source: R/coloralpha.R

Description

add alpha to colours

Usage

1
coloralpha(x, alpha = 0.5)

Arguments

x

character, can be a character vector, contains either names of colors (e.g. "red", "darkgreen") or their hexadecimal representation

alpha

numeric between 0 and 1, sets transparency (0 = transparent, 1 = opaque)

Value

color names in hexadecimal

Examples

1
2
3
4
5
6
7
8
coloralpha(c("#FF0000", "#FFD700"), alpha = 0.3)
coloralpha(c("red", "green"), alpha = 0.3)
coloralpha("#FF0000", alpha = 0.3)
coloralpha("red", alpha = 0.3)
mycols <- c("#F1BB7B", "#FD6467", "#5B1A18", "#D67236")
mycols <- coloralpha(mycols)
plot(1:4, 1:4, pch=16, cex=10, col=mycols)
points(1:4, 1:4+0.2, pch=16, cex=10, col=mycols)

gobbios/cfp documentation built on July 15, 2018, 3:45 p.m.