theme.ts
typescript
sha256:969ddc5e88776e70af33c016b8777bb721356508ae5f304b3fb46c451494ece7
test(mwp3): Phase 4 — fix adjacent suite regressions, lock …
Sonnet 4.6
22 days ago
| 1 | const STORAGE_KEY = 'musehub-theme'; |
| 2 | |
| 3 | export function applyStoredTheme(): void { |
| 4 | if (localStorage.getItem(STORAGE_KEY) === 'light') { |
| 5 | document.documentElement.dataset['theme'] = 'light'; |
| 6 | } |
| 7 | } |
| 8 | |
| 9 | export function toggleTheme(): void { |
| 10 | const isLight = document.documentElement.dataset['theme'] === 'light'; |
| 11 | if (isLight) { |
| 12 | delete document.documentElement.dataset['theme']; |
| 13 | localStorage.setItem(STORAGE_KEY, 'dark'); |
| 14 | } else { |
| 15 | document.documentElement.dataset['theme'] = 'light'; |
| 16 | localStorage.setItem(STORAGE_KEY, 'light'); |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | export function initThemeBtn(): void { |
| 21 | const btn = document.getElementById('navbar-theme-btn'); |
| 22 | if (btn) btn.addEventListener('click', toggleTheme); |
| 23 | } |
File History
2 commits
sha256:969ddc5e88776e70af33c016b8777bb721356508ae5f304b3fb46c451494ece7
test(mwp3): Phase 4 — fix adjacent suite regressions, lock …
Sonnet 4.6
22 days ago
sha256:1749b9cc5cd2583c56d3261c4c00a342c27435f3946d4bc3e70f76aa2795458a
docs(mwp-3): TDD implementation plan for job-enqueue idempo…
Opus 4.8
22 days ago