add.alpha: add.alpha

View source: R/common.R

add.alphaR Documentation

add.alpha

Description

add.alpha modifies a vector of named ('firebrick') or hexdecimal ('#B22222') color specifications to add an alpha (transparency) channel. Inspired by https://gist.github.com/mages/5339689

Usage

add.alpha(col, alpha)

Arguments

col:

A string vector of colour names or hex colour strings.

alpha:

A number between 0 (solid) and 1 (fully transparent).

Value

A string vector of modified hex colour strings.

Examples

require(RColorBrewer)
pal <- add.alpha(brewer.pal(5, 'Set1'), 0.5)
plot(rnorm(100), rnorm(100), pch=21, col='black', bg=pal, cex=10)


ArtPoon/ggfree documentation built on July 11, 2024, 11:15 a.m.