/*
*@param startColor 开始颜色
* @param endColor 结束颜色
* @steps 步数
* @return colorList 结果颜色列表
*/
function calcLinearColor(start, end, steps) {
const colorList = [];
let startR = parseInt(start.slice(1, 3), 16);
let endR = parseInt(end.slice(1, 3), 16) - startR;
let startG = parseInt(start.slice(3, 5), 16);
let endG = parseInt(end.slice(3, 5), 16) - startG;
let startB = parseInt(start.slice(5, 7), 16);
let endB = parseInt(end.slice(5, 7), 16) - startB;
for(var i = 0; i < steps; i++) {
let r = Math.round(startR + (endR / steps * i));
let g = Math.round(startG + (endG / steps * i));
let b = Math.round(startB + (endB / steps * i));
r = r.toString(16).padStart(2, '0').toUpperCase();
g = g.toString(16).padStart(2, '0').toUpperCase();
b = b.toString(16).padStart(2, '0').toUpperCase();
colorList.push(`#${r.toString(16)}${g.toString(16)}${b.toString(16)}`);
}
return colorList;
}