createColorRamp: Fast color interpolation

Description Usage Arguments Value See Also

Description

Returns a function that maps the interval [0,1] to a set of colors. Interpolation is performed in the CIELAB color space. Similar to colorRamp(space = 'Lab'), but hundreds of times faster, and provides results in "#RRGGBB" (or "#RRGGBBAA") character form instead of RGB color matrices.

Usage

1
createColorRamp(colors, na.color = NA, alpha = FALSE)

Arguments

colors

Colors to interpolate; must be a valid argument to col2rgb. This can be a character vector of "#RRGGBB" or "#RRGGBBAA", color names from colors, or a positive integer that indexes into palette().

na.color

The color to map to NA values (for example, "#606060" for dark grey, or "#00000000" for transparent) and values outside of [0,1]. Can itself by NA, which will simply cause an NA to be inserted into the output.

alpha

Whether to include alpha channels in interpolation; otherwise, any alpha information will be discarded. If TRUE then the returned function will provide colors in "#RRGGBBAA" format instead of "#RRGGBB".

Value

A function that takes a numeric vector and returns a character vector of the same length with RGB or RGBA hex colors.

See Also

colorRamp


jcheng5/rasterfaster documentation built on May 18, 2019, 10:22 p.m.