From 058b4ba658668a75d6700c8914d42918a363779c Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Tue, 17 Sep 2019 14:08:48 +0200 Subject: [PATCH] Fix theme rgb creation (#3738) --- src/common/dom/apply_themes_on_element.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/common/dom/apply_themes_on_element.ts b/src/common/dom/apply_themes_on_element.ts index 029ef1d3cc..22b13893c0 100644 --- a/src/common/dom/apply_themes_on_element.ts +++ b/src/common/dom/apply_themes_on_element.ts @@ -44,14 +44,15 @@ export default function applyThemesOnElement( if (key.startsWith("rgb")) { return; } - const rgbKey = `--rgb-${key}`; - if (theme[rgbKey] === undefined) { + const rgbKey = `rgb-${key}`; + if (theme[rgbKey] !== undefined) { return; } - element._themes[rgbKey] = ""; + const prefixedRgbKey = `--${rgbKey}`; + element._themes[prefixedRgbKey] = ""; const rgbValue = hexToRgb(theme[key]); if (rgbValue !== null) { - styles[rgbKey] = rgbValue; + styles[prefixedRgbKey] = rgbValue; } }); }