ui: light theme default + dark/light toggle

- Light theme: clean white (#fff) base, soft gray surfaces, professional feel
- Dark theme: deep navy (#0f1117), elevated layers, subtle shadows
- Theme toggle button (moon/sun icons) in header, persists via localStorage
- Auto-detects system prefers-color-scheme on first visit
- CSS variables for all colors, both themes defined in same file
- Improved contrast ratios for both modes (WCAG AA)
This commit is contained in:
unknown
2026-04-05 09:51:41 +08:00
parent 053a2188bc
commit 5d6b2789b1
3 changed files with 214 additions and 135 deletions
+179 -134
View File
@@ -1,43 +1,76 @@
/* ============================================================ /* ============================================================
MultiPage Automation — Side Panel Theme MultiPage Automation — Side Panel
Design: Dark OLED / Developer Tool Design: Swiss Modernism + Developer Tool
Font: Inter (UI) + JetBrains Mono (code/data) Font: Inter (UI) + JetBrains Mono (code)
Colors: Blue primary (#2563EB), Green success (#22C55E), Themes: Light (default) + Dark (toggle)
Orange warning (#F97316), Red error (#EF4444)
============================================================ */ ============================================================ */
/* ---- Light Theme (default) ---- */
:root { :root {
--bg-base: #0a0a0b; --bg-base: #ffffff;
--bg-surface: #141416; --bg-surface: #f7f8fa;
--bg-elevated: #1c1c20; --bg-elevated: #eef0f4;
--bg-hover: #252529; --bg-hover: #e4e7ec;
--bg-active: #2a2a30; --bg-active: #dce0e8;
--border: #2a2a30; --border: #d8dce3;
--border-subtle: #1e1e22; --border-subtle: #e8ecf1;
--text-primary: #e8e8ed; --text-primary: #1a1d24;
--text-secondary: #8b8b96; --text-secondary: #5c6370;
--text-muted: #5c5c66; --text-muted: #9ca3af;
--blue: #2563eb; --blue: #2563eb;
--blue-glow: rgba(37, 99, 235, 0.15); --blue-soft: rgba(37, 99, 235, 0.08);
--green: #22c55e; --blue-glow: rgba(37, 99, 235, 0.12);
--green-glow: rgba(34, 197, 94, 0.12); --green: #16a34a;
--orange: #f97316; --green-soft: rgba(22, 163, 74, 0.08);
--orange-glow: rgba(249, 115, 22, 0.12); --orange: #ea580c;
--red: #ef4444; --orange-soft: rgba(234, 88, 12, 0.08);
--red-glow: rgba(239, 68, 68, 0.12); --red: #dc2626;
--cyan: #06b6d4; --red-soft: rgba(220, 38, 38, 0.08);
--purple: #a78bfa; --cyan: #0891b2;
--purple: #7c3aed;
--shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
--shadow-md: 0 2px 6px rgba(0,0,0,0.06);
--radius-sm: 6px; --radius-sm: 6px;
--radius-md: 8px; --radius-md: 8px;
--radius-lg: 10px;
--transition: 150ms ease; --transition: 150ms ease;
} }
/* ---- Dark Theme ---- */
[data-theme="dark"] {
--bg-base: #0f1117;
--bg-surface: #181a21;
--bg-elevated: #21242d;
--bg-hover: #2a2e38;
--bg-active: #323844;
--border: #2a2e38;
--border-subtle: #21242d;
--text-primary: #e4e6eb;
--text-secondary: #8b919e;
--text-muted: #565c6a;
--blue: #3b82f6;
--blue-soft: rgba(59, 130, 246, 0.12);
--blue-glow: rgba(59, 130, 246, 0.18);
--green: #22c55e;
--green-soft: rgba(34, 197, 94, 0.12);
--orange: #f97316;
--orange-soft: rgba(249, 115, 22, 0.12);
--red: #ef4444;
--red-soft: rgba(239, 68, 68, 0.12);
--cyan: #06b6d4;
--purple: #a78bfa;
--shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
--shadow-md: 0 2px 8px rgba(0,0,0,0.3);
}
* { margin: 0; padding: 0; box-sizing: border-box; } * { margin: 0; padding: 0; box-sizing: border-box; }
body { body {
@@ -49,6 +82,7 @@ body {
width: 100%; width: 100%;
min-height: 100vh; min-height: 100vh;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
transition: background var(--transition), color var(--transition);
} }
/* ============================================================ /* ============================================================
@@ -59,31 +93,55 @@ header {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
margin-bottom: 12px; margin-bottom: 14px;
padding-bottom: 12px; padding-bottom: 12px;
border-bottom: 1px solid var(--border-subtle); border-bottom: 1px solid var(--border-subtle);
} }
.header-title { .header-left {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 8px; gap: 8px;
color: var(--text-primary);
} }
.header-title svg { color: var(--blue); } .header-left svg { color: var(--blue); }
.header-title h1 { .header-left h1 {
font-size: 14px; font-size: 14px;
font-weight: 700; font-weight: 700;
letter-spacing: -0.02em; letter-spacing: -0.02em;
color: var(--text-primary);
} }
.header-btns { .header-btns {
display: flex; display: flex;
gap: 6px; align-items: center;
gap: 4px;
} }
/* ============================================================
Theme Toggle
============================================================ */
.theme-toggle {
width: 30px;
height: 30px;
border: none;
background: transparent;
color: var(--text-muted);
border-radius: var(--radius-sm);
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all var(--transition);
}
.theme-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }
.theme-toggle .icon-moon { display: block; }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
/* ============================================================ /* ============================================================
Buttons Buttons
============================================================ */ ============================================================ */
@@ -96,7 +154,7 @@ header {
font-family: inherit; font-family: inherit;
font-size: 12px; font-size: 12px;
font-weight: 600; font-weight: 600;
border: none; border: 1px solid transparent;
border-radius: var(--radius-sm); border-radius: var(--radius-sm);
cursor: pointer; cursor: pointer;
transition: all var(--transition); transition: all var(--transition);
@@ -107,30 +165,38 @@ header {
background: var(--blue); background: var(--blue);
color: #fff; color: #fff;
} }
.btn-primary:hover { background: #3b82f6; box-shadow: 0 0 12px var(--blue-glow); } .btn-primary:hover { opacity: 0.9; box-shadow: 0 2px 8px var(--blue-glow); }
.btn-success { .btn-success {
background: var(--green); background: var(--green);
color: #fff; color: #fff;
} }
.btn-success:hover { background: #16a34a; box-shadow: 0 0 12px var(--green-glow); } .btn-success:hover { opacity: 0.9; box-shadow: 0 2px 8px var(--green-soft); }
.btn-success:disabled { background: var(--bg-elevated); color: var(--text-muted); cursor: not-allowed; box-shadow: none; } .btn-success:disabled { background: var(--bg-elevated); color: var(--text-muted); cursor: not-allowed; box-shadow: none; }
.btn-ghost { .btn-ghost {
background: transparent; background: transparent;
color: var(--text-secondary); color: var(--text-secondary);
padding: 6px 8px; padding: 6px;
border-radius: var(--radius-sm);
} }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); } .btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-outline {
background: transparent;
border: 1px solid var(--border);
color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }
.btn-sm { padding: 4px 10px; font-size: 11px; } .btn-sm { padding: 4px 10px; font-size: 11px; }
.btn-xs { padding: 2px 8px; font-size: 10px; } .btn-xs { padding: 3px 8px; font-size: 10px; }
/* ============================================================ /* ============================================================
Data Card Data Card
============================================================ */ ============================================================ */
#data-section { margin-bottom: 12px; } #data-section { margin-bottom: 14px; }
.data-card { .data-card {
background: var(--bg-surface); background: var(--bg-surface);
@@ -139,7 +205,8 @@ header {
padding: 10px 12px; padding: 10px 12px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 8px; gap: 7px;
box-shadow: var(--shadow-sm);
} }
.data-row { .data-row {
@@ -149,18 +216,18 @@ header {
} }
.data-label { .data-label {
width: 56px; width: 54px;
font-size: 11px; font-size: 10px;
font-weight: 600; font-weight: 700;
color: var(--text-muted); color: var(--text-muted);
text-transform: uppercase; text-transform: uppercase;
letter-spacing: 0.04em; letter-spacing: 0.06em;
flex-shrink: 0; flex-shrink: 0;
} }
.data-value { .data-value {
font-size: 11px; font-size: 11px;
color: var(--text-secondary); color: var(--text-muted);
min-width: 0; min-width: 0;
} }
@@ -180,18 +247,18 @@ header {
.data-input { .data-input {
flex: 1; flex: 1;
padding: 5px 8px; padding: 5px 8px;
background: var(--bg-elevated); background: var(--bg-base);
border: 1px solid var(--border); border: 1px solid var(--border);
border-radius: var(--radius-sm); border-radius: var(--radius-sm);
color: var(--text-primary); color: var(--text-primary);
font-family: 'JetBrains Mono', monospace; font-family: 'JetBrains Mono', monospace;
font-size: 11px; font-size: 11px;
outline: none; outline: none;
transition: border-color var(--transition); transition: border-color var(--transition), box-shadow var(--transition);
min-width: 0; min-width: 0;
} }
.data-input::placeholder { color: var(--text-muted); } .data-input::placeholder { color: var(--text-muted); }
.data-input:focus { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue-glow); } .data-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
/* Status Bar */ /* Status Bar */
.status-bar { .status-bar {
@@ -204,55 +271,56 @@ header {
border: 1px solid var(--border); border: 1px solid var(--border);
border-radius: var(--radius-sm); border-radius: var(--radius-sm);
font-size: 11px; font-size: 11px;
font-weight: 500;
color: var(--text-secondary); color: var(--text-secondary);
box-shadow: var(--shadow-sm);
} }
.status-dot { .status-dot {
width: 6px; width: 7px;
height: 6px; height: 7px;
border-radius: 50%; border-radius: 50%;
background: var(--text-muted); background: var(--text-muted);
flex-shrink: 0; flex-shrink: 0;
transition: background var(--transition);
} }
.status-bar.running .status-dot { .status-bar.running .status-dot {
background: var(--orange); background: var(--orange);
animation: pulse 1.5s ease-in-out infinite; animation: pulse 1.5s ease-in-out infinite;
} }
.status-bar.running { color: var(--orange); }
.status-bar.completed .status-dot { background: var(--green); } .status-bar.completed .status-dot { background: var(--green); }
.status-bar.completed { color: var(--green); }
.status-bar.failed .status-dot { background: var(--red); } .status-bar.failed .status-dot { background: var(--red); }
.status-bar.failed { color: var(--red); }
@keyframes pulse { @keyframes pulse {
0%, 100% { opacity: 1; } 0%, 100% { opacity: 1; transform: scale(1); }
50% { opacity: 0.3; } 50% { opacity: 0.4; transform: scale(0.85); }
} }
/* Auto Continue Bar */ /* Auto Continue Bar */
.auto-continue-bar { .auto-continue-bar {
margin-top: 8px; margin-top: 8px;
padding: 8px 10px; padding: 8px 10px;
background: var(--orange-glow); background: var(--orange-soft);
border: 1px solid rgba(249, 115, 22, 0.25); border: 1px solid rgba(234, 88, 12, 0.2);
border-radius: var(--radius-sm); border-radius: var(--radius-sm);
display: flex; display: flex;
align-items: center; align-items: center;
gap: 8px; gap: 8px;
} }
.auto-continue-bar svg { color: var(--orange); flex-shrink: 0; } .auto-continue-bar svg { color: var(--orange); flex-shrink: 0; }
.auto-hint { font-size: 11px; color: var(--orange); flex: 1; font-weight: 500; }
.auto-hint {
font-size: 11px;
color: var(--orange);
flex: 1;
}
/* ============================================================ /* ============================================================
Steps Section Steps Section
============================================================ */ ============================================================ */
#steps-section { margin-bottom: 12px; } #steps-section { margin-bottom: 14px; }
.steps-header { .steps-header {
display: flex; display: flex;
@@ -262,17 +330,22 @@ header {
} }
.section-label { .section-label {
font-size: 11px; font-size: 10px;
font-weight: 600; font-weight: 700;
color: var(--text-muted); color: var(--text-muted);
text-transform: uppercase; text-transform: uppercase;
letter-spacing: 0.06em; letter-spacing: 0.08em;
} }
.steps-progress { .steps-progress {
font-family: 'JetBrains Mono', monospace; font-family: 'JetBrains Mono', monospace;
font-size: 11px; font-size: 10px;
font-weight: 600;
color: var(--text-muted); color: var(--text-muted);
background: var(--bg-surface);
padding: 2px 8px;
border-radius: 10px;
border: 1px solid var(--border);
} }
.steps-list { .steps-list {
@@ -285,7 +358,7 @@ header {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 8px; gap: 8px;
padding: 2px 0; padding: 1px 0;
transition: opacity var(--transition); transition: opacity var(--transition);
} }
@@ -294,7 +367,7 @@ header {
width: 22px; width: 22px;
height: 22px; height: 22px;
border-radius: 50%; border-radius: 50%;
background: var(--bg-elevated); background: var(--bg-surface);
border: 1.5px solid var(--border); border: 1.5px solid var(--border);
display: flex; display: flex;
align-items: center; align-items: center;
@@ -305,28 +378,19 @@ header {
.step-num { .step-num {
font-size: 10px; font-size: 10px;
font-weight: 600; font-weight: 700;
color: var(--text-muted); color: var(--text-muted);
transition: color var(--transition);
} }
/* Step states via indicator */ .step-row.running .step-indicator { border-color: var(--orange); background: var(--orange-soft); }
.step-row.running .step-indicator {
border-color: var(--orange);
background: var(--orange-glow);
animation: pulse 1.5s ease-in-out infinite;
}
.step-row.running .step-num { color: var(--orange); } .step-row.running .step-num { color: var(--orange); }
.step-row.running .step-indicator { animation: pulse 1.5s ease-in-out infinite; }
.step-row.completed .step-indicator { .step-row.completed .step-indicator { border-color: var(--green); background: var(--green-soft); }
border-color: var(--green);
background: var(--green-glow);
}
.step-row.completed .step-num { color: var(--green); } .step-row.completed .step-num { color: var(--green); }
.step-row.failed .step-indicator { .step-row.failed .step-indicator { border-color: var(--red); background: var(--red-soft); }
border-color: var(--red);
background: var(--red-glow);
}
.step-row.failed .step-num { color: var(--red); } .step-row.failed .step-num { color: var(--red); }
/* Step Button */ /* Step Button */
@@ -343,46 +407,27 @@ header {
cursor: pointer; cursor: pointer;
text-align: left; text-align: left;
transition: all var(--transition); transition: all var(--transition);
box-shadow: var(--shadow-sm);
} }
.step-btn:hover:not(:disabled) { background: var(--bg-hover); border-color: var(--blue); }
.step-btn:disabled { color: var(--text-muted); background: var(--bg-base); border-color: var(--border-subtle); cursor: not-allowed; opacity: 0.45; box-shadow: none; }
.step-btn:hover:not(:disabled) { .step-row.running .step-btn { border-color: var(--orange); color: var(--orange); }
background: var(--bg-hover); .step-row.completed .step-btn { border-color: var(--border-subtle); color: var(--text-secondary); opacity: 0.7; }
border-color: var(--blue); .step-row.failed .step-btn { border-color: var(--red); color: var(--red); }
}
.step-btn:disabled {
color: var(--text-muted);
background: var(--bg-base);
border-color: var(--border-subtle);
cursor: not-allowed;
opacity: 0.5;
}
.step-row.running .step-btn {
border-color: var(--orange);
color: var(--orange);
}
.step-row.completed .step-btn {
border-color: var(--border-subtle);
color: var(--text-secondary);
}
.step-row.failed .step-btn {
border-color: var(--red);
color: var(--red);
}
/* Step Status Icon (right side) */
.step-status { .step-status {
width: 20px; width: 18px;
text-align: center; text-align: center;
font-size: 12px; font-size: 12px;
font-weight: 700;
flex-shrink: 0; flex-shrink: 0;
} }
.step-row.completed .step-status { color: var(--green); }
.step-row.failed .step-status { color: var(--red); }
/* ============================================================ /* ============================================================
Log Section Log / Console Section
============================================================ */ ============================================================ */
.log-header { .log-header {
@@ -401,22 +446,22 @@ header {
overflow-y: auto; overflow-y: auto;
font-family: 'JetBrains Mono', 'Consolas', monospace; font-family: 'JetBrains Mono', 'Consolas', monospace;
font-size: 10.5px; font-size: 10.5px;
line-height: 1.65; line-height: 1.7;
color: var(--text-secondary); color: var(--text-secondary);
box-shadow: var(--shadow-sm);
} }
#log-area::-webkit-scrollbar { width: 4px; } #log-area::-webkit-scrollbar { width: 5px; }
#log-area::-webkit-scrollbar-track { background: transparent; } #log-area::-webkit-scrollbar-track { background: transparent; }
#log-area::-webkit-scrollbar-thumb { background: var(--bg-hover); border-radius: 4px; } #log-area::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 4px; }
#log-area::-webkit-scrollbar-thumb:hover { background: var(--text-muted); } #log-area::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
/* Log line styles */ .log-line { padding: 1.5px 0; }
.log-line { padding: 1px 0; }
.log-line + .log-line { border-top: 1px solid var(--border-subtle); } .log-line + .log-line { border-top: 1px solid var(--border-subtle); }
.log-time { color: var(--text-muted); } .log-time { color: var(--text-muted); }
.log-level { font-weight: 600; } .log-level { font-weight: 700; margin: 0 2px; }
.log-level-info { color: var(--blue); } .log-level-info { color: var(--blue); }
.log-level-ok { color: var(--green); } .log-level-ok { color: var(--green); }
.log-level-warn { color: var(--orange); } .log-level-warn { color: var(--orange); }
@@ -426,24 +471,24 @@ header {
display: inline-block; display: inline-block;
padding: 0 4px; padding: 0 4px;
border-radius: 3px; border-radius: 3px;
font-weight: 600; font-weight: 700;
font-size: 9.5px; font-size: 9.5px;
margin-right: 2px; margin-right: 3px;
} }
.log-step-tag.step-1 { color: var(--cyan); background: rgba(8, 145, 178, 0.08); }
.log-step-tag.step-1 { color: var(--cyan); background: rgba(6, 182, 212, 0.1); } .log-step-tag.step-2 { color: var(--purple); background: rgba(124, 58, 237, 0.08); }
.log-step-tag.step-2 { color: var(--purple); background: rgba(167, 139, 250, 0.1); } .log-step-tag.step-3 { color: #b45309; background: rgba(180, 83, 9, 0.06); }
.log-step-tag.step-3 { color: #facc15; background: rgba(250, 204, 21, 0.1); } [data-theme="dark"] .log-step-tag.step-3 { color: #fbbf24; background: rgba(251, 191, 36, 0.1); }
.log-step-tag.step-4 { color: var(--orange); background: var(--orange-glow); } .log-step-tag.step-4 { color: var(--orange); background: var(--orange-soft); }
.log-step-tag.step-5 { color: var(--green); background: var(--green-glow); } .log-step-tag.step-5 { color: var(--green); background: var(--green-soft); }
.log-step-tag.step-6 { color: var(--cyan); background: rgba(6, 182, 212, 0.1); } .log-step-tag.step-6 { color: var(--cyan); background: rgba(8, 145, 178, 0.08); }
.log-step-tag.step-7 { color: var(--orange); background: var(--orange-glow); } .log-step-tag.step-7 { color: var(--orange); background: var(--orange-soft); }
.log-step-tag.step-8 { color: var(--purple); background: rgba(167, 139, 250, 0.1); } .log-step-tag.step-8 { color: var(--purple); background: rgba(124, 58, 237, 0.08); }
.log-step-tag.step-9 { color: var(--green); background: var(--green-glow); } .log-step-tag.step-9 { color: var(--green); background: var(--green-soft); }
.log-msg { color: var(--text-secondary); } .log-msg { color: var(--text-secondary); }
.log-line.log-ok .log-msg { color: var(--green); } .log-line.log-ok .log-msg { color: var(--green); font-weight: 500; }
.log-line.log-error .log-msg { color: var(--red); } .log-line.log-error .log-msg { color: var(--red); font-weight: 500; }
.log-line.log-warn .log-msg { color: var(--orange); } .log-line.log-warn .log-msg { color: var(--orange); }
/* ============================================================ /* ============================================================
@@ -451,11 +496,11 @@ header {
============================================================ */ ============================================================ */
@keyframes fadeIn { @keyframes fadeIn {
from { opacity: 0; transform: translateY(4px); } from { opacity: 0; transform: translateY(3px); }
to { opacity: 1; transform: translateY(0); } to { opacity: 1; transform: translateY(0); }
} }
.log-line { animation: fadeIn 150ms ease-out; } .log-line { animation: fadeIn 120ms ease-out; }
@media (prefers-reduced-motion: reduce) { @media (prefers-reduced-motion: reduce) {
*, *::before, *::after { *, *::before, *::after {
+9 -1
View File
@@ -11,7 +11,7 @@
</head> </head>
<body> <body>
<header> <header>
<div class="header-title"> <div class="header-left">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M13 2L3 14h9l-1 8 10-12h-9l1-8z"/> <path d="M13 2L3 14h9l-1 8 10-12h-9l1-8z"/>
</svg> </svg>
@@ -27,6 +27,14 @@
<polyline points="1 4 1 10 7 10"/><path d="M3.51 15a9 9 0 1 0 2.13-9.36L1 10"/> <polyline points="1 4 1 10 7 10"/><path d="M3.51 15a9 9 0 1 0 2.13-9.36L1 10"/>
</svg> </svg>
</button> </button>
<button id="btn-theme" class="theme-toggle" title="Toggle theme">
<svg class="icon-moon" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/>
</svg>
<svg class="icon-sun" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="5"/><line x1="12" y1="1" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="23"/><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/><line x1="1" y1="12" x2="3" y2="12"/><line x1="21" y1="12" x2="23" y2="12"/><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/>
</svg>
</button>
</div> </div>
</header> </header>
+26
View File
@@ -310,10 +310,36 @@ chrome.runtime.onMessage.addListener((message) => {
} }
}); });
// ============================================================
// Theme Toggle
// ============================================================
const btnTheme = document.getElementById('btn-theme');
function setTheme(theme) {
document.documentElement.setAttribute('data-theme', theme);
localStorage.setItem('multipage-theme', theme);
}
function initTheme() {
const saved = localStorage.getItem('multipage-theme');
if (saved) {
setTheme(saved);
} else if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
setTheme('dark');
}
}
btnTheme.addEventListener('click', () => {
const current = document.documentElement.getAttribute('data-theme');
setTheme(current === 'dark' ? 'light' : 'dark');
});
// ============================================================ // ============================================================
// Init // Init
// ============================================================ // ============================================================
initTheme();
restoreState().then(() => { restoreState().then(() => {
updateButtonStates(); updateButtonStates();
}); });