analyze_palette: Analyze a categorical color palette

View source: R/analyze_palette.R

analyze_paletteR Documentation

Analyze a categorical color palette

Description

Analyze a categorical color palette with respect to the differences between the colors in the palette.

Usage

analyze_palette(
  palette,
  cvd = c(protan = 0, deutan = 0, tritan = 0),
  bg = NULL,
  metric = c("ciede2000", "din99d", "cie76")
)

Arguments

palette

Either a matrix of RGB values (with values between 0 and 1), a data frame with RGB values, or a character vector of hex colors.

cvd

Color vision deficiency adaptation. This must be a named vector with names protan, deutan, and tritan and values between 0 and 1, where 0 means no adaptation and 1 means full adaptation.

bg

Background color to consider (but not include) when generating the palette. This is useful to avoid colros that are too close to the background/canvas color. If NULL (the default), the background color is not considered at all. Any color that is convertable via col2rgb is acceptable, including hex colors.

metric

The color metric to use for the color distance matrix.

Value

A list of lists, one for each type of color vision deficiency plus normal vision. Each list contains difference_matrix, min_distances, and bg_min_distance

See Also

qualpal()

Examples

pal <- qualpal(5)
analyze_palette(pal$hex, cvd = c(protan = 1))


qualpalr documentation built on Aug. 19, 2025, 1:14 a.m.