splot.colorcontrast {splot} | R Documentation |
splot color contrast ratio
Description
Calculates the color contrast ratio between two sets of colors, as defined by the World Wide Web Consortium.
Usage
splot.colorcontrast(color, background = "#ffffff", plot = TRUE)
Arguments
color , background |
A character vector of colors, or a matrix with RGB values across rows. |
plot |
Logical; if |
Value
A list with entries for ratio
(contrast ratio),
AA
(ratios of at least 4.5), and AAA
(ratios of at least 7).
Each entry contains a matrix with colors in rows and backgrounds in columns.
Examples
# check colors against dark and light backgrounds
splot.colorcontrast(c("#FF0000", "#00FF00", "#0000FF"), c("black", "white"))
# check contrast between colors
splot.colorcontrast(c("red", "green", "blue"), c("red", "green", "blue"))
# see when shades of a color cross thresholds on a given background
splot.colorcontrast(splot.color(1:10, seed = "#a388b5"), "#101010")
[Package splot version 0.5.4 Index]