This commit is contained in:
Anaïs Saraiva
2026-08-25 12:32:54 +02:00
parent b1b4f03814
commit 1b3b45b348
12 changed files with 193 additions and 95 deletions
+20
View File
@@ -0,0 +1,20 @@
const KEY = 'filehost.theme';
export function currentTheme() {
return document.documentElement.classList.contains('dark') ? 'dark' : 'light';
}
export function applyTheme(theme) {
document.documentElement.classList.toggle('dark', theme === 'dark');
try {
localStorage.setItem(KEY, theme);
} catch {
/* ignore */
}
}
export function toggleTheme() {
const next = currentTheme() === 'dark' ? 'light' : 'dark';
applyTheme(next);
return next;
}