theme: erststart (auch einrichtung) immer hell, statt windows-modus

Kein gespeicherter Wert -> 'light' (vorher 'system'). Inline-Skript im head
setzt das Theme flackerfrei vor dem ersten Paint; gespeicherte Wahl bleibt.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-11-27 00:02:42 +01:00
parent 1b4421b681
commit 54a6a79158
2 changed files with 5 additions and 3 deletions

View File

@@ -3635,7 +3635,7 @@ function closeBackup() {
// Theme mode: 'light', 'dark' or 'system' (follows Windows, also live when it changes).
const systemDark = matchMedia('(prefers-color-scheme: dark)')
let themeMode = 'system'
let themeMode = 'light' // default until initTheme reads the saved choice (first start = light)
function applyTheme() {
const theme = themeMode === 'system' ? (systemDark.matches ? 'dark' : 'light') : themeMode
@@ -3690,7 +3690,7 @@ function initTheme() {
let saved = null
try { saved = localStorage.getItem('dash.theme') } catch {}
saved = new URLSearchParams(location.search).get('theme') ?? saved
themeMode = ['light', 'dark', 'system'].includes(saved) ? saved : 'system'
themeMode = ['light', 'dark', 'system'].includes(saved) ? saved : 'light' // first start (also setup): light
applyTheme()
}
systemDark.addEventListener('change', () => { if (themeMode === 'system') applyTheme() })