View source: R/check_vangogh_cvd.R
| check_vangogh_cvd | R Documentation |
Simulates how a Van Gogh palette appears under different types of color vision deficiency and provides accessibility scores. This function complements the existing check_palette() function by adding visual simulation and quantitative metrics.
check_vangogh_cvd(
palette_name,
n = NULL,
simulate = TRUE,
return_scores = FALSE
)
palette_name |
Character string specifying the palette name (e.g., "StarryNight") |
n |
Integer. Number of colors to extract from palette. Default is NULL (uses all colors). |
simulate |
Logical. If TRUE, displays simulations for each CVD type. Default TRUE. |
return_scores |
Logical. If TRUE, returns detailed scoring data. Default FALSE. |
This function evaluates palette accessibility across three main types of color vision deficiency:
Deuteranopia (red-green, affects ~5% of males)
Protanopia (red-green, affects ~2% of males)
Tritanopia (blue-yellow, affects ~0.01% of population)
The function uses the colorspace package for CVD simulation and calculates minimum pairwise perceptual distance in CIELAB color space to assess distinguishability.
If return_scores = TRUE, returns a data frame with CVD scores. Otherwise, displays visual simulations and prints a summary.
## Not run:
# Visual simulation of StarryNight palette
check_vangogh_cvd("StarryNight")
# Get detailed scores without plotting
scores <- check_vangogh_cvd("Irises", simulate = FALSE, return_scores = TRUE)
# Check subset of colors
check_vangogh_cvd("CafeTerrace", n = 3)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.