palette_dist: Distance Between Colors

Description Usage Arguments Value Examples

View source: R/palette_dist.R

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

1
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

1
2
3
4
5
6
7
8
9
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)

colorblindcheck documentation built on Sept. 9, 2021, 9:09 a.m.