palette_dist {colorblindcheck} | R Documentation |
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)