createPalette | R Documentation |
Tool to create new palettes that are well separated in CIE L*u*v* color space.
createPalette(N, seedcolors, prefix = "NC", range = c(30, 90), target = c("normal", "protanope", "deuteranope", "tritanope"), M = 50000)
N |
An integer, the size of the palette to create. |
seedcolors |
A character vector containing the hexadecimal representations of one or more colors. |
prefix |
A character string to be used as a prefix to numeric names of the colors. |
range |
A numeric vector limitng the range of allowed luminance values. |
target |
A character string indicating the kind of color vision for which the palette is intended. |
M |
An integer; the number of random colors to generate while creating palettes. |
Carter and Carter showed that "perceptual distinguishability" of
colors was related to their Euclidean distance in the L*u*v* color
space coordinates, as defined by the International Commisision on
Illumination (CIE). The createPalette
function implements a
greedy algorithm to find colors that are well-spread-out in L*u*v*
space. The algorithm begins by generating a random set of 50,000
colors; these colors are restricted to those whose luminance lies
between 30 and 90. Then, given one or more starting colors, the
algorithm finds the random color that maximizes the distance to the
closest existing color point. This process continues until N
colors have been selected.
A character string containing the hexadecimal representations of
N
colors that are well spread out in CIE L*u*v* color space.
Kevin R. Coombes <krc@silicovore.com>
Carter RC, Carter EC. High-contrast sets of colors. Applied Optics, 1982; 21(16):2936–9.
Coombes KR, Brock G, Abrams ZB, Abruzzo LV. Polychrome: Creating and Assessing Qualitative Palettes with Many Colors. Journal of Statistical Software. 2019; 90(1):1–23.
Color Palettes
, colorDeficit
.
seed <- c("#ff0000", "#00ff00", "#0000ff") mycolors <- createPalette(15, seed, prefix="mine") swatch(mycolors)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.