cranvas (version 0.8.5)

lighter: Generate lighter colors

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

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.

Examples

Run this code
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)
}

Run the code above in your browser using DataLab