feat: add theme switching

This commit is contained in:
2025-11-12 23:13:02 +04:00
parent d4624b1729
commit 36e07ade98
5 changed files with 318 additions and 5 deletions
+20
View File
@@ -75,6 +75,26 @@
"nonprofitStatus": "NonprofitANBI"
}
</script>
<script>
(function() {
// Récupérer le thème stocké ou détecter le thème système
const storedTheme = localStorage.getItem('oki-theme');
const systemPrefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
let theme = storedTheme;
// Si pas de préférence stockée, utiliser le thème système
if (!storedTheme) {
theme = systemPrefersDark ? 'dark' : 'light';
}
// Appliquer le thème immédiatement
if (theme === 'light') {
document.documentElement.classList.add('light-theme');
}
})();
</script>
</head>
<body>
{% include "partials/nav.njk" %}
+4
View File
@@ -13,6 +13,10 @@
</li>
{% endfor %}
</ul>
<button id="theme-toggle" class="theme-toggle" aria-label="Changer de thème" title="Changer de thème">
<span class="theme-icon theme-icon-dark">🌙</span>
<span class="theme-icon theme-icon-light">☀️</span>
</button>
<div class="menu-toggle">
<span></span>
<span></span>