Mix colors against multiple color stops.
import ColorStops from 'colorstops';
$ browserify colorstops.js --standalone ColorStops -o colorstops-browser.js
let colorStops = new ColorStops([
{ color: '#FF0000', value: 20 },
{ color: '#00FF00', value: 40 },
{ color: '#0000FF', value: 80 }
]);
Get a mixed hex color string for an input value against the defined color stops.
colorStops.hex(-200); // '#FF0000'
colorStops.hex(20); // '#FF0000'
colorStops.hex(30); // '#808000'
colorStops.hex(40); // '#00FF00'
colorStops.hex(41); // '#00F906'
colorStops.hex(79); // '#0006F9'
colorStops.hex(200); // '#0000FF'
$ npm run test
This software is released under the terms of the MIT license. See LICENSE
.