Fix light theme detection logic (check absence of dark class)
This commit is contained in:
@@ -400,8 +400,8 @@
|
||||
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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user