coloralpha: add alpha to colours

View source: R/coloralpha.R

coloralphaR Documentation

add alpha to colours

Description

add alpha to colours

Usage

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

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 April 11, 2022, 2:22 a.m.