Skip to contents

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.

See also

Author

N. Frerebeau

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))
}
#>           1         2         3         4
#> 2 15.133194                              
#> 3 38.752027 19.522094                    
#> 4 26.072281  9.633077 10.043244          
#> 5 17.098221 31.695821 56.285350 41.893242