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:
1 parent
4c444b3d8d
commit
7ac7bf5878
18 files changed
+758
-361
No files matched your search
@@ -2,6 +2,7 @@
|
||||
|
||||
import { useEffect, useRef } from "react";
|
||||
import { usePathname } from "next/navigation";
|
||||
import ThemeSwitch from "@/components/ThemeSwitch";
|
||||
|
||||
const NAV = [
|
||||
{ href: "/", key: "nav.home", label: "หน้าแรก" },
|
||||
@@ -104,6 +105,8 @@ export default function SiteHeader() {
|
||||
</div>
|
||||
</details>
|
||||
|
||||
<ThemeSwitch />
|
||||
|
||||
<div className="mu-lang-switch" role="group" aria-label="ภาษา / Language">
|
||||
<button type="button" className="mu-lang-btn" data-i18n-switch="th">
|
||||
ไทย
|
||||
|
||||
Reference in new issue
Block a user