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; } }); }