| color_distance | R Documentation |
Calculate color distance between two or more colors
color_distance(
x,
y = NULL,
method = c("cie2000", "cie94", "cie1976", "cmc", "euclidean"),
use_white = "F5",
do_plot = FALSE,
...
)
x |
|
y |
|
method |
|
use_white |
|
... |
additional arguments are passed to |
Color distance is calculated using farver::compare_colour(),
with some defaults intended in future to assist with color blindness
calculations.
numeric color distance with length(x) entries when both
x and y are supplied, or a numeric matrix with color distances
between all entries in x.
An attribute 'method' is added with the color distance used,
mainly so the method can be used by show_color_distance(),
but also by other methods as relevant.
color_distance("red", "firebrick", use_white="D65")
color_distance(grDevices::palette.colors(15))
pc <- rainbowJam(5)
cd <- color_distance(pc);
show_color_distance(cd, pc=pc, column_title="rainbowJam()");
pc <- grDevices::palette.colors(15);
cd <- color_distance(pc);
show_color_distance(cd, pc=pc, column_title="palette.colors()");
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.