compare: Color Difference

View source: R/compare.R

compareR Documentation

Color Difference

Description

Computes CIELAB distance metric.

Usage

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

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?

Value

A distance matrix.

Author(s)

N. Frerebeau

See Also

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

Examples

if (requireNamespace("spacesXYZ", quietly = TRUE)) {
  ## 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))
}

khroma documentation built on April 4, 2025, 2:37 a.m.