lighter: Generate lighter colors

Description Usage Arguments Value Author(s) Examples

View source: R/utils.R

Description

This function first converts colors to the RGB and HSV space, then modifies the brightness (the V component in HSV) by an amount.

Usage

1
lighter(color, factor = 0.2)

Arguments

color

the color vector

factor

numeric: larger than 0 means to make the color lighter, and less than 0 means darker (can be either a vector or a scalar)

Value

The modified color vector.

Author(s)

Heike Hofmann and Yihui Xie

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
lighter(palette())

par(mfrow = c(2, 1), mar = rep(0, 4))
d <- c("black", grep("dark", colors(), value = TRUE))  # dark colors
x <- rep(1, length(d))
for (f in seq(0, 1, length = 20)) {
    barplot(x, col = d)
    barplot(x, col = lighter(d, f))
    if (interactive()) 
        Sys.sleep(0.2)
}

ggobi/cranvas documentation built on May 17, 2019, 3:10 a.m.