A palette function converts numerical inputs into colors. A path is defined by the intersection of a hue-surface with a chroma-trajectory, in a given color space.

Use pth_new_palette_path() to create a palette function by defining a path. You can create a trajectory using pth_new_chroma_trajectory(); you can create a surface using pth_new_hue_surface(). Use the constructor to identify which color space the palette function will use.

Use pth_new_palette_hex() to create a palette function using a vector of hex codes. The function will use a spline defined in the color space identified by the transformer argument.

pth_new_palette_path(trajectory, surface, constructor = pth_new_cieluv, ...)

pth_new_palette_hex(hex, transformer = pth_to_cieluv, ...)

Arguments

trajectory

function with class pth_chroma_trajectory, used to define the path that the luminance and chroma follow.

surface

function with class pth_hue_surface, used to define the hue as a function of luminance.

constructor

function that constructs a pth_mat, used to identify the color space for the output matrix.

...

other arguments passed to constructor or transformer

hex

character that can be coerced to a six-digit hex code.

transformer

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

Value

function with S3 classes pth_palette_path, pth_palette. For each given value (0 <= x <= 1), returns a matrix, in the color space associated with constructor, with a row for each value.