You can evaluate distance for categorial palettes (_cat functions), or for quantitative functions (_qnt functions). You can evaluate using Euclidean distance in a color space (_euclid functions), or using a metric (_metric functions).

pth_data_cat_euclid(color, ...)

# S3 method for default
pth_data_cat_euclid(color, ...)

# S3 method for character
pth_data_cat_euclid(
  color,
  cvd = pth_cvd_grid_severity(),
  transformer = NULL,
  non_luminance_weight = 1,
  ...
)

# S3 method for pth_hex
pth_data_cat_euclid(
  color,
  cvd = pth_cvd_grid_severity(),
  transformer = NULL,
  non_luminance_weight = 1,
  ...
)

# S3 method for pth_mat
pth_data_cat_euclid(
  color,
  cvd = pth_cvd_grid_severity(),
  transformer = NULL,
  non_luminance_weight = 1,
  ...
)

pth_data_cat_metric(color, ...)

# S3 method for default
pth_data_cat_metric(color, ...)

# S3 method for character
pth_data_cat_metric(
  color,
  cvd = pth_cvd_grid_severity(),
  method = c("cie2000", "cie94", "cie1976", "cmc"),
  ...
)

# S3 method for pth_hex
pth_data_cat_metric(
  color,
  cvd = pth_cvd_grid_severity(),
  method = c("cie2000", "cie94", "cie1976", "cmc"),
  ...
)

# S3 method for pth_mat
pth_data_cat_metric(
  color,
  cvd = pth_cvd_grid_severity(),
  method = c("cie2000", "cie94", "cie1976", "cmc"),
  ...
)

pth_data_qnt_euclid(palette, ...)

# S3 method for default
pth_data_qnt_euclid(palette, ...)

# S3 method for pth_palette
pth_data_qnt_euclid(
  palette,
  n_step = 12,
  cvd = pth_cvd_grid_severity(),
  transformer = NULL,
  non_luminance_weight = 1,
  ...
)

pth_data_qnt_metric(palette, ...)

# S3 method for default
pth_data_qnt_metric(palette, ...)

# S3 method for pth_palette
pth_data_qnt_metric(
  palette,
  n_step = 12,
  cvd = pth_cvd_grid_severity(),
  method = c("cie2000", "cie94", "cie1976", "cmc"),
  ...
)

Arguments

color

Object that can be coerced into colors, i.e. pth_hex or pth_mat. Used for categorical palettes.

...

additional arguments passed on to transformer.

cvd

tbl_df with columns condition, severity; see pth_cvd_grid().

transformer

function used to transform the colors to new color space, e.g. pth_to_cieluv.

non_luminance_weight

numeric used to "discount" the effects of chroma and hue in the distance calculation.

method

character metric used by farver::compare_colour().

palette

function with S3 class pth_palette. Used for quantitative palettes.

n_step

Object coerced to integer, number of steps to take along palette, 0 <= x <= 1.

Value

tbl_df with columns:

hex_original_a

character hex-code of original color.

hex_original_b

character hex-code of original color.

condition

character type of color-vision deficiency.

severity

numeric indicates severity using scale 0-1.

hex_a

character hex-code of color under CVD.

hex_b

character hex-code of color under CVD.

distance

numeric perceptual distance between colors

Each row describes an interaction between two colors in a palette. For a categorical palette (_cat functions), each color in the palette is compared with all the colors in the palette; for n colors, a tibble with n^2 rows is returned. For a quantitative palette (_qnt functions), the palette is discretized; each color is compared with its neighbors. A data frame with n_step rows is returned.