gabriel / musehub public
theme.ts typescript
23 lines 707 B
Raw
sha256:5601f81903b6c70ddd11bd88a5a257ee6dfd38aa3b85b19746c100c030657f1e chore: update smoke_muse.sh comment to reference rc9 Sonnet 4.6 minor ⚠ breaking 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:5601f81903b6c70ddd11bd88a5a257ee6dfd38aa3b85b19746c100c030657f1e chore: update smoke_muse.sh comment to reference rc9 Sonnet 4.6 minor 22 days ago
sha256:39e9c4e6f2134da0732e6983268a218178973936f8d7ca03c91f2b5ad42133c8 fix: use read_object_bytes in blob viewer; add zstd magic d… Sonnet 4.6 patch 22 days ago