linear-gradient
calculates the color representing a number based on the gradient supplied
Purpose
When using charts and maps to visualize data, it is useful to map values to a color gradient. This package provides the functions to map values to color gradients.
Examples
Instantiate object with the graident palette, then use it to calculate the color representing a value
var Gradient = ; // instantiate with an RGB palettevar grad1 = 000 0800 016080 808080 1604040 25500; // now we are ready to calculate the colors// the input value should be normalized to the range between 0 and 1 console; // -> [0,0,0] (0 -> first color of the palette)console; // -> [255,0,0] (1 -> last color of the palette)console; // -> [0,100,20] (weighted average between [0,80,0] and [0,160,80])console;console; console; // -> '#ffffff'console; // -> '#006416'