//Generates an array of size howMany with colors from start RGB to end RGB
//toHex() function is on my profile.
//toHex() function is on my profile.
function generateColors(sred, sgreen, sblue, ered, egreen, eblue, howMany) { // loop to create var arColors = new Array(); for(var i = 0; i < howMany; ++i) { // set current red descriptor var red = Math.floor(sred * ((howMany - i) / howMany) + ered * (i / howMany)); // set current green descriptor var green = Math.floor(sgreen * ((howMany - i) / howMany) +egreen * (i / howMany)); // set current green descriptor var blue = Math.floor(sblue * ((howMany - i) / howMany) + eblue * (i / howMany)); arColors[i] = [toHex(red), toHex(green), toHex(blue)]; } return arColors; }