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