A simple color interpolator component
$ component install jsantell/interpolate-color
var interpolate = require('interpolate-color');
var red = 'hsl(0, 100%, 50%)';
var green = 'hsl(120, 100%, 50%)';
interpolate(red, green, 0.5); // 'hsl(60, 100%, 50%)'
from
the starting position HSL string (hsl(0, 100%, 50%)
)to
the end position HSL stringstep
the normalized value (between 0 and 1) of the interpolation. A step of0.5
would be the middle offrom
andto
precision
an optional argument of how many points of precision the results should have (default:0
)
View ./test/index.html
MIT License