1hexToRGB(hex, alpha) {
2
3 const r = parseInt(hex.slice(1, 3), 16);
4 const g = parseInt(hex.slice(3, 5), 16);
5 const b = parseInt(hex.slice(5, 7), 16);
6
7 if (alpha) {
8 return `rgba(${r}, ${g}, ${b}, ${alpha})`;
9 } else {
10 return `rgb(${r}, ${g}, ${b})`;
11 }
12}
13
1hexToRGB(hex, alpha) {
2
3 const r = parseInt(hex.slice(1, 3), 16);
4 const g = parseInt(hex.slice(3, 5), 16);
5 const b = parseInt(hex.slice(5, 7), 16);
6
7 if (alpha) {
8 return `rgba(${r}, ${g}, ${b}, ${alpha})`;
9 } else {
10 return `rgb(${r}, ${g}, ${b})`;
11 }
12}