📜  html 获取颜色渐变百分比 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:31.395000             🧑  作者: Mango

代码示例1
function pickHex(color1, color2, weight) {
    var w1 = weight;
    var w2 = 1 - w1;
    var rgb = [Math.round(color1[0] * w1 + color2[0] * w2),
        Math.round(color1[1] * w1 + color2[1] * w2),
        Math.round(color1[2] * w1 + color2[2] * w2)];
    return rgb;
}