js实现颜色转换 一、hex转rgba const hex2Rgba = (bgColor, alpha = 1) => { let color = bgColor.slice(1); // 去掉'#'号 let rgba = [ parseInt("0x" + color.slice(0, 2)), parseInt(