We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d5dff75 commit 124cf54Copy full SHA for 124cf54
docs/js/index.js
@@ -28,9 +28,14 @@ document.addEventListener('DOMContentLoaded', function() {
28
return 'light';
29
}
30
31
- // Apply theme on page load
+ // Apply theme on page load (only if not already set by inline script)
32
const initialTheme = getPreferredTheme();
33
- applyTheme(initialTheme);
+ const currentTheme = document.documentElement.classList.contains('dark') ? 'dark' : 'light';
34
+
35
+ // Only apply if the current theme doesn't match the preferred theme
36
+ if (currentTheme !== initialTheme) {
37
+ applyTheme(initialTheme);
38
+ }
39
40
// Theme toggle click handler
41
if (themeToggle) {
0 commit comments