Package 'colorblindcheck'

Title: 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 <http://www.vis4.net/blog/2018/02/automate-colorblind-checking/>.
Authors: Jakub Nowosad [aut, cre]
Maintainer: Jakub Nowosad <[email protected]>
License: MIT + file LICENSE
Version: 1.0.2
Built: 2024-07-13 05:56:14 UTC
Source: CRAN

Help Index


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)

Arguments

x

A vector of hexadecimal color descriptions

severity

Severity of the color vision defect, a number between 0 and 1

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"))

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 palette_dist() to control the color metric

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)

Arguments

x

A vector of hexadecimal color descriptions

severity

Severity of the color vision defect, a number between 0 and 1

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"))