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:
@@ -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() })
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
<!doctype html>
|
||||
<html lang="de">
|
||||
<html lang="de" data-theme="light">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Projekte</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<!-- set the theme before first paint (no flash). No saved choice = light, also on the setup/first run. -->
|
||||
<script>try{var s=localStorage.getItem('dash.theme');document.documentElement.dataset.theme=(s==='dark'||(s==='system'&&matchMedia('(prefers-color-scheme: dark)').matches))?'dark':'light'}catch(e){}</script>
|
||||
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236366f1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z'/%3E%3Cpath d='m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65'/%3E%3Cpath d='m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65'/%3E%3C/svg%3E">
|
||||
<style>
|
||||
:root {
|
||||
|
||||
Reference in New Issue
Block a user