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

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