Fix light theme detection logic (check absence of dark class)

This commit is contained in:
2026-07-10 16:44:23 +05:30
parent 0d6e0b83ac
commit 5b69f4fdca
2 changed files with 4 additions and 4 deletions

View File

@@ -400,8 +400,8 @@
setInterval(() => { setInterval(() => {
let isLight = false; let isLight = false;
try { try {
isLight = window.parent.document.documentElement.classList.contains('light') || // In Tailwind next-themes class strategy, light mode is defined by the absence of the 'dark' class.
window.parent.document.documentElement.getAttribute('data-theme') === 'light'; isLight = !window.parent.document.documentElement.classList.contains('dark');
} catch (e) { } catch (e) {
const p = new URLSearchParams(window.location.search); const p = new URLSearchParams(window.location.search);
isLight = p.get('theme') === 'light'; isLight = p.get('theme') === 'light';

View File

@@ -87,8 +87,8 @@ def port_html():
setInterval(() => { setInterval(() => {
let isLight = false; let isLight = false;
try { try {
isLight = window.parent.document.documentElement.classList.contains('light') || // In Tailwind next-themes class strategy, light mode is defined by the absence of the 'dark' class.
window.parent.document.documentElement.getAttribute('data-theme') === 'light'; isLight = !window.parent.document.documentElement.classList.contains('dark');
} catch (e) { } catch (e) {
const p = new URLSearchParams(window.location.search); const p = new URLSearchParams(window.location.search);
isLight = p.get('theme') === 'light'; isLight = p.get('theme') === 'light';