Fast colour interpolationSource:
Returns a function that maps the interval [0,1] to a set of colours.
Interpolation is performed in the CIELAB colour space. Similar to
colorRamp(space = 'Lab'), but hundreds of
times faster, and provides results in
"#RRGGBBAA") character form instead of RGB colour matrices.
Colours to interpolate; must be a valid argument to
grDevices::col2rgb(). This can be a character vector of
"#RRGGBBAA", colour names from
grDevices::colors(), or a positive integer that indexes into
The colour to map to
NAvalues (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
NAto be inserted into the output.
Whether to include alpha transparency channels in interpolation. If
TRUEthen the alpha information is included in the interpolation. The returned colours will be provided in
"#RRGGBBAA"format when needed, i.e., in cases where the colour is not fully opaque, so that the
"AA"part is not equal to
"FF". Fully opaque colours will be returned in
FALSE, the alpha information is discarded before interpolation and colours are always returned as
A function that takes a numeric vector and returns a character vector of the same length with RGB or RGBA hex colours.