Given a base color and a background, generate a pair of colors (light and dark) with sufficient perceptual contrast using WCAG or APCA methods.
adjust_contrast_pair(
color,
contrast = 4.5,
method = "auto",
background = "#FFFFFF",
quiet = FALSE
)
A list with elements light
, dark
, contrast
, and method
.
adjust_contrast_pair("#777777", contrast = 4.5, method = "auto", background = "#000000")
#> $light
#> [1] "#F1F1F1"
#>
#> $dark
#> [1] "#303030"
#>
#> $contrast
#> [1] 18.59245
#>
#> $method
#> [1] "WCAG"
#>
adjust_contrast_pair("#66CCFF", contrast = 4.5, method = "APCA", background = "#FAFAFA")
#> $light
#> [1] "#ADA025"
#>
#> $dark
#> [1] NA
#>
#> $contrast
#> [1] 48.95491
#>
#> $method
#> [1] "APCA"
#>