发布于 3年前
js 转换十六进制→RGB
const hex2rgb = hex =>
[1, 3, 5].map((h) => parseInt(hex.substring(h, h + 2), 16));
hex2rgb("#4c0bb5");
// [76, 11, 181]
const hex2rgb = hex =>
[1, 3, 5].map((h) => parseInt(hex.substring(h, h + 2), 16));
hex2rgb("#4c0bb5");
// [76, 11, 181]