contrastColors: Contrast colors.

View source: R/contrastColors.R

contrastColorsR Documentation

Contrast colors.

Description

For a given set of colors, contrastColors returns an associated set of colors.

Usage

contrastColors(colors, how = "how_borw", alpha = FALSE)

col2Hex(colors, alpha = FALSE)

Arguments

colors

vector of any of the three kinds of R color specifications, see grDevices::col2rgb().

how

a method to contrast colors. Methods currently available are how_borw, how_cent, how_oppo and how_prop, see details.

alpha

logical value indicating whether the alpha channel (opacity) values should be returned.

Details

Based on the sum of colors' saturation how_borw returns black or white, how_prop proportionally remove or add some saturation. how_oppo opposes the color (255-x) and how_cent centers the columns, i.e. remove or add 127.

Functions

  • contrastColors(): Retuns a set of colors contrasted.

  • col2Hex(): Returns the hexadecimal string associates to a given vector of colors.

See Also

grDevices::col2rgb()

Examples

contrastColors("blue")
contrastColors("blue", how = "how_prop")


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