Automatic generation of distinct qualitative color palettes, optionally adapted to color blindness. It takes a subspace of the HSL color space as input and projects it to the DIN99d color space where it selects and return colors that are maximally distinct.
qualpalr generates distinct qualitative color palettes, primarily for use in R graphics. Given
n (the number of colors to generate), along with a subset in the hsl color space (a cylindrical representation of the RGB color space)
qualpalr attempts to find the
n colors in the provided color subspace that maximize the smallest pairwise color difference. This is done by projecting the color subset from the HSL color space to the DIN99d space. DIN99d is (approximately) perceptually uniform, that is, the euclidean distance between two colors in the space is proportional to their perceived difference.
qualpalr was inspired by i want hue.
library(qualpalr) # 0.1 and 0.5, and lightness from 0.6 to 0.85pal <- qualpal(n = 4, list(h = c(0, 360), s = c(0.1, 0.5), l = c(0.6, 0.85)))# Look at the colors in hex formatpal$hex#>  "#C072C9" "#6FCB6F" "#78A7CA" "#D1AC97"# Create a palette using one of the predefined color subspaces, adapted to color# vision deficiencypal2 <- qualpal(n = 4, colorspace = "pretty", cvd = "deutan", cvd_severity = 0.5)# Distance matrix of the DIN99d color differencespal2$de_DIN99d#> 1 2 3#> 2 19#> 3 20 20#> 4 28 19 18
plot() methods have been prepared for objects created with
plot(pal)pairs(pal, colorspace = "hsl")
The current CRAN release can be installed by running
The development version can be installed by running
Versioning is based on semantic versioning.
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
qualpalr is open source software, licensed under GPL-3.
qualpal()that allows the user to set the severity of color deficiency to adapt to --
0for normal vision and
1for dichromatic vision (protanopia, deuteranopia, or tritanopia).
cvd(for color vision deficiency) since the function now adapts to less severe versions of color deficiency. Using
colorblindis deprecated and will throw a warning.
colorblindis used, but is more consistent with user input.
grDevices::convertColorto formulas from Bruce Lindbloom for color conversions, since the former function inaccurately converts colors.
qualpalsince the function no longer uses an optimizer.