Learn R Programming

khroma (version 1.14.0)

compare: Color Difference

Description

Computes CIELAB distance metric.

Usage

compare(x, metric = 2000, diag = FALSE, upper = FALSE)

Value

A distance matrix.

Arguments

x

A character vector of colors.

metric

An integer value giving the year the metric was recommended by the CIE. It must be one of "1976", "1994", or "2000" (default; see spacesXYZ::DeltaE()).

diag

A logical scalar: should the diagonal of the distance matrix be printed?

upper

A logical scalar: should the upper triangle of the distance matrix should be printed?

Author

N. Frerebeau

See Also

Other diagnostic tools: change(), plot.color_scheme(), plot_map(), plot_scheme(), plot_scheme_colourblind(), plot_tiles()

Examples

Run this code
# Trichromat
pal <- colour("bright")
compare(pal(5))

# Deuteranopia
deu <- change(pal, mode = "deuteranopia")
compare(deu(5))

# Protanopia
pro <- change(pal, mode = "protanopia")
compare(pro(5))

# Tritanopia
tri <- change(pal, mode = "tritanopia")
compare(tri(5))

# Achromatopsia
ach <- change(pal, mode = "achromatopsia")
compare(ach(5))

Run the code above in your browser using DataLab