From 4e34df82cc169419340fdaf8f7d574262262337e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Sun, 29 May 2022 13:29:58 +0200 Subject: [PATCH] Override custom panel defaults (#597) --- src/main.ts | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/src/main.ts b/src/main.ts index d55a0998..935be220 100644 --- a/src/main.ts +++ b/src/main.ts @@ -233,27 +233,14 @@ class HacsFrontend extends HacsElement { } private _applyTheme() { - let options: Partial | undefined; - - const themeName = - this.hass.selectedTheme?.theme || - (this.hass.themes.darkMode && this.hass.themes.default_dark_theme - ? this.hass.themes.default_dark_theme! - : this.hass.themes.default_theme); - - options = this.hass.selectedTheme; - if (themeName === "default" && options?.dark === undefined) { - options = { - ...this.hass.selectedTheme, - }; - } - - if (this.parentElement) { - applyThemesOnElement(this.parentElement, this.hass.themes, themeName, { - ...options, - dark: this.hass.themes.darkMode, - }); - this.parentElement.style.backgroundColor = "var(--primary-background-color)"; - } + applyThemesOnElement( + this.parentElement, + this.hass.themes, + (this.hass.selectedTheme as unknown as string) || this.hass.themes.default_theme, + undefined, + true + ); + this.parentElement!.style.backgroundColor = "var(--primary-background-color)"; + this.parentElement!.style.color = "var(--primary-text-color)"; } }