Skip to contents

Convert colors to grayScale using luminance weighting.

Usage

grayScale(col)

Arguments

col

vector of valid R colors.

Value

Character vector of grayScale colors.

Details

grayScale conversion uses the standard luminance approximation: $$0.3 R + 0.59 G + 0.11 B$$

Examples

op <- par(no.readonly = TRUE)
par(mfcol=c(2,2))

tmp <- 1:3
names(tmp) <- c('red','green','blue')

barplot(tmp, col=c('red','green','blue'))
barplot(tmp, col=grayScale(c('red','green','blue')))

barplot(tmp, col=c('red','#008100','#3636ff'))
barplot(tmp, col=grayScale(c('red','#008100','#3636ff')))


par(op)