export function hex2Rgb(hex) {
  let color = hex.toLowerCase();

  // 如果只有三位的值，需变成六位，如：#fff => #ffffff
  if (color.length === 4) {
    let colorNew = '#';
    for (var i = 1; i < 4; i += 1) {
      colorNew += color.slice(i, i + 1).concat(color.slice(i, i + 1));
    }
    color = colorNew;
  }
  // 处理六位的颜色值，转为RGB
  const colors = [];
  for (var i = 1; i < 7; i += 2) {
    colors.push(parseInt('0x' + color.slice(i, i + 2)));
  }
  return colors;
}
