If you are trying to create a color that is some percentage (0-100) between two other colors, you can do this with this javascript:
function makeGradientColor(color1, color2, percent) { var newColor = {}; function makeChannel(a, b) { return(a + Math.round((ba)*(percent/100))); } function makeColorPiece(num) { num = Math.min(num, 255);
This function assumes that the gradient is performed with linear interpolation between each r, g, and b value of the channel of the two colors of the end points, so that a 50% gradient value is the middle of each r, g, b value (halfway between the two colors are presented). After this, other types of gradients can be made (with various interpolation functions).
To assign this result to the background, you use the CSS color value, which I added to the return result as follows:
source share