Description Usage Arguments Details Value Examples
View source: R/color_contrast_checker.R
Get the color contrast of two colors
1 | color_contrast_checker(foreground, background = "#FFFFFF")
|
foreground |
Character string. An R color or color as hex. |
background |
Character string. An R color or color as hex. Default is white/'#FFFFFF'. |
This uses the api at webaim.org to determine the contrast ratio of the foreground color to the background color. This is useful to ensure chosen colors meet web standards for accessibility.
If you have jsonlite, it will return a data frame of the ratio and which standards are passed. Otherwise you get the same information but as a character vector.
1 2 3 4 5 6 7 8 | ## Not run:
library(visibly)
color_contrast_checker(foreground = 'red', background = 'papayawhip')
# standard blue is not good for contrasting links from other text
color_contrast_checker(foreground = '#000080', background = 'black')
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.