theme.ts
typescript
sha256:20b27796ed512236119feef48b4577a8fd9ded05a15267dd4e6da23604ad1f1a
docs: update Suggested Ownership Split table to reflect ful…
Sonnet 5
28 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
3 commits
sha256:20b27796ed512236119feef48b4577a8fd9ded05a15267dd4e6da23604ad1f1a
docs: update Suggested Ownership Split table to reflect ful…
Sonnet 5
28 days ago
sha256:8ea2f75226d5834770ccaddbaa6efda1cc337446fd481bb385de8bec4555ae79
docs: Section 9 CI pipeline — confirm job queue is idempote…
Sonnet 5
28 days ago
sha256:80e1a60a39562f6e616aaafbb27487f03abbec7d8ffc6164302b7a0c0bfc63ee
docs: check off Section 0 items verified in inventory doc, …
Sonnet 5
28 days ago