If I have colours #FF0CB6
and #EC9CF4
, how could I find 10 variations in between them (like a gradient would do) and eventually have them in an array?
Similar to what this website does: http://www.perbang.dk/rgbgradient/
Does anybody know how to approach this problem?
You can use 'RainbowVis-JS' and get the hex colour code between two color hex code.
var numberOfItems = 8;
var rainbow = new Rainbow();
rainbow.setNumberRange(1, numberOfItems);
rainbow.setSpectrum('red', 'black');
var s = '';
for (var i = 1; i <= numberOfItems; i++) {
var hexColour = rainbow.colourAt(i);
s += '#' + hexColour + ', ';
}
document.write(s);