theme : dark par défaut, ignore la préférence système
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
7efa08b269
commit
425073cff0
1 changed files with 1 additions and 4 deletions
|
|
@ -2,10 +2,7 @@ const root = document.documentElement;
|
||||||
|
|
||||||
function initTheme() {
|
function initTheme() {
|
||||||
const storedPreference = localStorage.getItem("theme");
|
const storedPreference = localStorage.getItem("theme");
|
||||||
const systemPrefersDark = window.matchMedia(
|
const theme = storedPreference || "dark";
|
||||||
"(prefers-color-scheme: dark)"
|
|
||||||
).matches;
|
|
||||||
const theme = storedPreference || (systemPrefersDark ? "dark" : "light");
|
|
||||||
root.setAttribute("data-theme", theme);
|
root.setAttribute("data-theme", theme);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue