fix(css): improve the handling of different color entries EE-3603 (#7134)

pull/7136/head
andres-portainer 2022-06-27 18:11:14 -03:00 committed by GitHub
parent cd19eb036b
commit 8eff32ebc7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 2 deletions

View File

@ -2,9 +2,17 @@ import colors from './colors.json';
const element = document.createElement('style');
element.innerHTML = `:root {
element.innerHTML = `:root {
${Object.entries(colors)
.map(([color, hex]) => `--ui-${color}: ${hex}`)
.map(([color, hex]) => {
if (typeof hex === 'string') {
return `--ui-${color}: ${hex}`;
}
return Object.entries(hex)
.map(([key, value]) => `--ui-${color}-${key}: ${value}`)
.join(';\n');
})
.join(';\n')}
}`;