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" %}
|
||||
|
||||
Reference in New Issue
Block a user