From f1369a4d4d9aaf6b9887374dab4e3dc6eb393ce5 Mon Sep 17 00:00:00 2001 From: Tara Rostami <132676256+TaraRostami@users.noreply.github.com> Date: Wed, 28 Feb 2024 09:35:33 +0330 Subject: [PATCH] Update themeSwitch.html --- web/html/xui/component/themeSwitch.html | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/web/html/xui/component/themeSwitch.html b/web/html/xui/component/themeSwitch.html index a23854c9..2301da94 100644 --- a/web/html/xui/component/themeSwitch.html +++ b/web/html/xui/component/themeSwitch.html @@ -11,10 +11,10 @@ function createThemeSwitcher() { const isDarkTheme = localStorage.getItem('dark-mode') === 'true'; const isUltra = localStorage.getItem('isUltraDarkThemeEnabled') === 'true'; - const theme = isDarkTheme ? 'dark' : 'light'; if (isUltra) { document.documentElement.setAttribute('data-theme', 'ultra-dark'); } + const theme = isDarkTheme ? 'dark' : 'light'; document.querySelector('body').setAttribute('class', theme); return { isDarkTheme, @@ -32,11 +32,10 @@ this.isUltra = !this.isUltra; if (this.isUltra) { document.documentElement.setAttribute('data-theme', 'ultra-dark'); - localStorage.setItem('isUltraDarkThemeEnabled', 'true'); } else { document.documentElement.removeAttribute('data-theme'); - localStorage.setItem('isUltraDarkThemeEnabled', 'false'); } + localStorage.setItem('isUltraDarkThemeEnabled', this.isUltra.toString()); } }; }