发布于 11个月前

js 转换十六进制→RGB

const hex2rgb = hex =>
  [1, 3, 5].map((h) => parseInt(hex.substring(h, h + 2), 16));

hex2rgb("#4c0bb5");
// [76, 11, 181]
©2020 edoou.com   京ICP备16001874号-3