darken: Lighten or darken colors

View source: R/darken.R

rampR Documentation

Lighten or darken colors

Description

Returns lightened or darkened colors, vectorised over percentage. ramp is valid for any couple of colors. Functions darken() and lighten() call ramp to respectively darken and lighten a given color.

Usage

ramp(fromcol, tocol, percentage = 50, as_rgb = FALSE)

darken(col, percentage = 50, as_rgb = FALSE)

lighten(col, percentage = 50, as_rgb = FALSE)

Arguments

fromcol

starting color, i.e. percentage = 0, it is the color returned.

tocol

color to nuance fromcol, i.e. percentage = 100, it is the color returned.

percentage

percentage determining the percentage of tocol used to nuance fromcol. Note that darken and lighten support negative percentage.

as_rgb

a logical. Should the color(s) returned as a matrix object?

col

the color to be darkened or lightened.

Functions

  • ramp(): Returns a shaded color.

  • darken(): Darken a color.

  • lighten(): Lighten a color.

See Also

grDevices::colorRampPalette()

Examples

showPalette(ramp("blue", "red", 10 * 3:7))
darken("red", 50)
more_reds <- lighten("red", seq(10, 90, 9))
showPalette(more_reds)


KevCaz/graphicsutils documentation built on Sept. 16, 2022, 10:05 a.m.