The purpose of these functions is to rescale the input to palette functions. Inputs to palette functions must be 0 <= x <= 1. A rescaler maps x to x' such that 0 <= x' <= 1; a mapping function will be monotonic.

pth_palette_rescale_reverse() reverses the input, so that x maps to 1 - x.

pth_palette_rescale_domain() expands a part of input domain, so that x maps to domain.

The other rescaling functions, pth_palette_rescale_euclid() and pth_palette_rescale_metric(), are used so to rescale a palette function such that a constant change in input, x, results in a constant change in color, for a given definition of "change in color".

pth_palette_rescale_reverse(palette)

pth_palette_rescale_domain(palette, domain = c(0, 1))

pth_palette_rescale_euclid(
  palette,
  tolerance = 1e-04,
  non_luminance_weight = 1,
  transformer = identity,
  ...
)

pth_palette_rescale_metric(
  palette,
  tolerance = 1e-04,
  method = c("cie2000", "cie94", "cie1976", "cmc")
)

Arguments

palette

function with S3 class pth_palette.

domain

numeric vector with length 2, each value between 0 and 1. Rescales to map new inputs of 0 and 1 to these values.

tolerance

numeric relative tolerance for distance calculations.

non_luminance_weight

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

transformer

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

...

additional arguments passed on to transformer.

method

character metric used by farver::compare_colour().

Value

function with the same S3 classes as palette