Add 3-mode theme system (light / dark / auto by device clock) and tokenize colors

- theme.css: semantic tokens (bg, surface, ink, border, brand, tints, status, glass)
- ThemeSwitch.tsx: radiogroup with light/dark/auto, persisted in localStorage
- auto mode follows device time (06:00-18:00 light), rechecks every minute and on visibilitychange
- inline pre-paint script in layout.tsx prevents flash of wrong theme
- remapped ~250 hardcoded hex declarations across styles to tokens
- fixed --c-ink-2 contrast 4.25 -> 5.36 (WCAG AA) in light mode
- 0 contrast failures below 4.5:1 across 8 pages in both themes
- DESIGN.md: documented theme system
This commit is contained in:
Bkk1234 committed 2026-10-23 23:01:06 +07:00
1 parent 4c444b3d8d
commit 7ac7bf5878
18 files changed
+758 -361

No files matched your search

+10 -10
View File
@@ -10,7 +10,7 @@
.mu-hero-lead {
margin: 14px auto 0;
max-width: 640px;
color: #5b3b71;
color: var(--c-brand-ink);
font-size: .95rem;
}
@@ -26,7 +26,7 @@
gap: 14px;
}
.mu-stop-card {
background: #fff;
background: var(--c-surface);
border-radius: 16px;
overflow: hidden;
box-shadow: 0 4px 14px rgba(20, 40, 90, .06);
@@ -47,7 +47,7 @@
padding: 14px 16px;
color: #fff;
}
.mu-stop-head.tone-purple { background: linear-gradient(135deg, #7a4cc0 0%, #b07ce0 100%); }
.mu-stop-head.tone-purple { background: linear-gradient(135deg, var(--c-brand) 0%, #b07ce0 100%); }
.mu-stop-head.tone-sky { background: linear-gradient(135deg, #3071b8 0%, #6ea7e8 100%); }
.mu-stop-head.tone-mint { background: linear-gradient(135deg, #1f8765 0%, #51c39c 100%); }
.mu-stop-head.tone-pink { background: linear-gradient(135deg, #bb3a78 0%, #f08bb9 100%); }
@@ -58,7 +58,7 @@
gap: 6px;
padding: 5px 12px;
border-radius: 999px;
background: rgba(255, 255, 255, .24);
background: var(--c-glass-24);
font-size: .74rem;
font-weight: 700;
white-space: nowrap;
@@ -70,9 +70,9 @@
.mu-stop-card[open] > summary .mu-stop-chevron { transform: rotate(180deg); }
.mu-stop-body { padding: 16px; }
.mu-stop-sub { font-weight: 700; color: #1f2a44; margin: 0 0 10px; font-size: .9rem; }
.mu-stop-sub { font-weight: 700; color: var(--c-ink); margin: 0 0 10px; font-size: .9rem; }
.mu-direction-tag {
background: #7a4cc0;
background: var(--c-brand);
color: #fff;
border-radius: 999px;
padding: 3px 10px;
@@ -84,8 +84,8 @@
.mu-time-chip {
padding: 6px 12px;
border-radius: 10px;
background: #f1f4fb;
color: #2b2f42;
background: var(--c-tint-purple);
color: var(--c-ink);
font-weight: 700;
font-size: .85rem;
border: 1px solid #e6eaf3;
@@ -99,11 +99,11 @@
}
.mu-schedule-note {
color: #9a3b6e;
color: var(--c-danger);
font-size: .82rem;
margin: 12px 0 0;
padding: 8px 12px;
background: #fff5f9;
background: var(--c-tint-pink);
border-left: 3px solid #bb3a78;
border-radius: 8px;
display: flex;