theme.ts
typescript
sha256:bba4b69de173366aeb7d490d687ccffb6db9726374033addece89cf2b87642d8
docs: add production launch discovery report and infra laun…
Sonnet 5
7 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:bba4b69de173366aeb7d490d687ccffb6db9726374033addece89cf2b87642d8
docs: add production launch discovery report and infra laun…
Sonnet 5
7 days ago
sha256:eb0928124669c933c0ef852bea1ad0c56649cf21bd7e9663c3b51004771b0591
docs: add MuseHub cloud identity/AWS operating model and Go…
Sonnet 5
patch
8 days ago