autopal {qualpalr} | R Documentation |
Optimize color palette for color vision deficiency
Description
This function adapts color palettes to color vision deficiency (CVD) by
optimizing the CVD severity to try reach a target color difference (DIN99d
\delta E
) of the user's choosing. Basically, it will choose a color
palette that is as close as possible to the target \delta E
by
tweaking the CVD severity option in qualpal
.
Usage
autopal(
n,
colorspace = "pretty",
cvd = c("protan", "deutan", "tritan"),
target = 20
)
Arguments
n |
Number of colors to generate. |
colorspace |
Either 1) a list of three named numeric vectors: |
cvd |
Color vision deficiency adaptation to adapt the color palette to. |
target |
Target color difference. |
Details
The rationale for this function is that when there are few colors in a color
palette, there is no cost involved in adapting colors to CVD – the colors
will still remain distinct. As more an more colors are added to the palette,
however, adapting the color palette to CVD will eventually lead to colors
that are too similar. This function gradually loosens the adaptation to CVDs
by lowering the severity of CVD to simulate to before picking colors (the
cvd_severity
argument in qualpal
)
Value
A list of class qualpal
with the following
components.
HSL |
A matrix of the colors in the HSL color space. |
DIN99d |
A matrix of the colors in the DIN99d color space (after power transformations). |
RGB |
A matrix of the colors in the sRGB color space. |
hex |
A character vector of the colors in hex notation. |
de_DIN99d |
A distance matrix of color differences according to delta E DIN99d. |
min_de_DIN99d |
The smallest pairwise DIN99d color difference. |
Examples
pal <- autopal(3, cvd = "protan", target = 15)
plot(pal)