feat: add theme switching
This commit is contained in:
@@ -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" %}
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user