For a given set of colors, contrastColors
returns an associated set
of colors.
contrastColors(colors, how = "how_borw", alpha = FALSE) col2Hex(colors, alpha = FALSE)
colors | vector of any of the three kinds of R color specifications, see |
---|---|
how | a method to contrast |
alpha | logical value indicating whether the alpha channel (opacity) values should be returned. |
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.
contrastColors
: Retuns a set of colors contrasted.
col2Hex
: Returns the hexadecimal string associates to a given vector of colors.
contrastColors('blue')#> [1] "#ffffff"contrastColors('blue', how = 'how_prop')#> [1] "#bfbfff"