mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
This reverts commit 51f5334748.
This commit is contained in:
@@ -89,7 +89,7 @@
|
||||
"rollup-plugin-esbuild": "5.0.0",
|
||||
"rollup-plugin-node-externals": "^5.0.0",
|
||||
"sinon": "14.0.1",
|
||||
"typescript": "4.9.3"
|
||||
"typescript": "4.8.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^16.8.0 || ^17.0.0",
|
||||
|
||||
@@ -32,23 +32,19 @@ export function hexToRgb(color: string) {
|
||||
color = color.slice(1);
|
||||
|
||||
const re = new RegExp(`.{1,${color.length >= 6 ? 2 : 1}}`, 'g');
|
||||
const result = color.match(re);
|
||||
if (!result) {
|
||||
return '';
|
||||
}
|
||||
let colors = Array.from(result);
|
||||
let colors = color.match(re);
|
||||
|
||||
if (colors[0].length === 1) {
|
||||
if (colors && colors[0].length === 1) {
|
||||
colors = colors.map((n) => n + n);
|
||||
}
|
||||
|
||||
const segments = colors
|
||||
.map((n, index) => {
|
||||
return index < 3 ? parseInt(n, 16) : Math.round((parseInt(n, 16) / 255) * 1000) / 1000;
|
||||
})
|
||||
.join(', ');
|
||||
|
||||
return `rgb${colors.length === 4 ? 'a' : ''}(${segments})`;
|
||||
return colors
|
||||
? `rgb${colors.length === 4 ? 'a' : ''}(${colors
|
||||
.map((n, index) => {
|
||||
return index < 3 ? parseInt(n, 16) : Math.round((parseInt(n, 16) / 255) * 1000) / 1000;
|
||||
})
|
||||
.join(', ')})`
|
||||
: '';
|
||||
}
|
||||
|
||||
function intToHex(int: number) {
|
||||
|
||||
Reference in New Issue
Block a user