| Title: | Check Color Palettes for Problems with Color Vision Deficiency | 
| Version: | 1.0.4 | 
| Description: | Compare color palettes with simulations of color vision deficiencies - deuteranopia, protanopia, and tritanopia. It includes calculation of distances between colors, and creating summaries of differences between a color palette and simulations of color vision deficiencies. This work was inspired by the blog post at https://www.datawrapper.de/blog/colorblind-check. | 
| Imports: | colorspace, methods, spacesXYZ | 
| Suggests: | rcartocolor, testthat, knitr, rmarkdown, covr, vdiffr | 
| License: | MIT + file LICENSE | 
| Encoding: | UTF-8 | 
| RoxygenNote: | 7.3.3 | 
| VignetteBuilder: | knitr | 
| URL: | https://jakubnowosad.com/colorblindcheck/ | 
| BugReports: | https://github.com/Nowosad/colorblindcheck/issues | 
| NeedsCompilation: | no | 
| Packaged: | 2025-10-09 09:10:35 UTC; jn | 
| Author: | Jakub Nowosad  | 
| Maintainer: | Jakub Nowosad <nowosad.jakub@gmail.com> | 
| Repository: | CRAN | 
| Date/Publication: | 2025-10-09 09:30:02 UTC | 
colorblindcheck: Check Color Palettes for Problems with Color Vision Deficiency
Description
Compare color palettes with simulations of color vision deficiencies - deuteranopia, protanopia, and tritanopia. It includes calculation of distances between colors, and creating summaries of differences between a color palette and simulations of color vision deficiencies. This work was inspired by the blog post at https://www.datawrapper.de/blog/colorblind-check.
Author(s)
Maintainer: Jakub Nowosad nowosad.jakub@gmail.com (ORCID)
See Also
Useful links:
Report bugs at https://github.com/Nowosad/colorblindcheck/issues
Plot Bivariate Palette And Its Color Vision Deficiencies
Description
Plot of the original input bivariate palette and simulations of color vision deficiencies - deuteranopia, protanopia, and tritanopia.
Usage
palette_bivariate_plot(x, severity = 1, show_hex = FALSE)
Arguments
x | 
 A vector of hexadecimal color descriptions  | 
severity | 
 Severity of the color vision defect, a number between 0 and 1  | 
show_hex | 
 whether to display hexadecimal color descriptions in plot  | 
Value
A plot with the original input palette and simulations of color vision deficiencies - deuteranopia, protanopia, and tritanopia
See Also
palette_plot
Examples
palette_bivariate_plot(x = rcartocolor::carto_pal(4, "Sunset"))
palette_bivariate_plot(x = rcartocolor::carto_pal(4, "Sunset"), show_hex = TRUE)
# Technically, "Sunset" from {rcartocolor} is not a bivariate palette,
# an example using an actual bivariate palette would be the following:
# palette_bivariate_plot(x = pals::brewer.seqseq1())
Compare Palette with Color Vision Deficiencies
Description
Comparision of the original input palette and simulations of color vision deficiencies - deuteranopia, protanopia, and tritanopia.
Usage
palette_check(
  x,
  tolerance = NULL,
  plot = FALSE,
  bivariate = FALSE,
  severity = 1,
  ...
)
Arguments
x | 
 A vector of hexadecimal color descriptions  | 
tolerance | 
 The minimal value of acceptable difference between the colors to distinguish between them. As the default, minimal distance between colors in the original input palette is given.  | 
plot | 
 If TRUE, display a plot comparing the original input palette and simulations of color vision deficiencies - deuteranopia, protanopia, and tritanopia  | 
bivariate | 
 If TRUE (and plot = TRUE), display a bivariate plot (plot where colors are located in columns and rows) comparing the original input palette and simulations of color vision deficiencies - deuteranopia, protanopia, and tritanopia  | 
severity | 
 Severity of the color vision defect, a number between 0 and 1  | 
... | 
 Other arguments passed on to   | 
Value
A data.frame with 4 observations and 8 variables:
name: orginal input color palette (normal), deuteranopia, protanopia, and tritanopia
n: number of colors
tolerance: minimal value of acceptable difference between the colors to distinguish between them
ncp: number of color pairs
ndcp: number of differentiable color pairs (color pairs with distances above the tolerance value)
min_dist: minimal distance between colors
mean_dist: average distance between colors
max_dist: maximal distance between colors
Additionally, a plot comparing the original input palette and simulations of color vision deficiencies - deuteranopia, protanopia, and tritanopia can be shown.
Examples
rainbow_pal = rainbow(n = 7)
rainbow_pal
palette_check(rainbow_pal, plot = TRUE)
x = rcartocolor::carto_pal(11, "Vivid")
palette_check(x)
palette_check(x, plot = TRUE)
palette_check(x, tolerance = 1)
palette_check(x, tolerance = 10, metric = 1976)
palette_check(x, plot = TRUE, severity = 0.5)
y = rcartocolor::carto_pal(4, "Sunset")
palette_check(y, plot = TRUE, bivariate = TRUE, severity = 0.5)
Distance Between Colors
Description
Calculation of the distances between the colors in the input palette. It also allows for calculation of the distances between the colors in a simulations of the color vision deficiency - deuteranopia, protanopia, and tritanopia.
Usage
palette_dist(x, cvd = NULL, severity = 1, metric = 2000)
Arguments
x | 
 A vector of hexadecimal color descriptions  | 
cvd | 
 A type of color vision deficiency (CVD): "pro" (protanomaly), "deu" (deutanomaly), or "tri" (tritanomaly)  | 
severity | 
 Severity of the color vision defect, a number between 0 and 1  | 
metric | 
 A vector of color metric specifiers. Valid values are '1976', '1994', and '2000' (default), which refer to the year the metric was recommended by the CIE  | 
Value
A matrix of distances between the original input palette and a simulation of the selected color vision deficiency - deuteranopia, protanopia, and tritanopia
Examples
rainbow_pal = rainbow(n = 7)
rainbow_pal
palette_dist(rainbow_pal)
palette_dist(rainbow_pal, cvd = "deu")
x = rcartocolor::carto_pal(11, "Vivid")
palette_dist(x)
palette_dist(x, cvd = "pro", severity = 1)
palette_dist(x, cvd = "pro", severity = 0.2)
Plot Palette And Its Color Vision Deficiencies
Description
Plot of the original input palette and simulations of color vision deficiencies - deuteranopia, protanopia, and tritanopia.
Usage
palette_plot(x, severity = 1, show_hex = FALSE)
Arguments
x | 
 A vector of hexadecimal color descriptions  | 
severity | 
 Severity of the color vision defect, a number between 0 and 1  | 
show_hex | 
 whether to display hexadecimal color descriptions in plot  | 
Value
A plot with the original input palette and simulations of color vision deficiencies - deuteranopia, protanopia, and tritanopia
See Also
palette_bivariate_plot
Examples
rainbow_pal = rainbow(n = 7)
rainbow_pal
palette_plot(rainbow_pal)
palette_plot(x = rcartocolor::carto_pal(7, "Sunset"))
palette_plot(x = rcartocolor::carto_pal(11, "Safe"))
palette_plot(x = rcartocolor::carto_pal(7, "Earth"))
palette_plot(x = rcartocolor::carto_pal(11, "Vivid"))
palette_plot(x = rcartocolor::carto_pal(11, "Vivid"), show_hex = TRUE)