Download web/src/lib/theme.ts from techfreakworm/chatterbox-voice-studio: direct link, hf CLI and curl.
- Browser
- Download file 453 Bytes
-
https://huggingface.co/spaces/techfreakworm/chatterbox-voice-studio/resolve/main/web/src/lib/theme.ts
- Command line
-
hf download hf://spaces/techfreakworm/chatterbox-voice-studio/web/src/lib/theme.ts
-
curl -L -o theme.ts https://huggingface.co/spaces/techfreakworm/chatterbox-voice-studio/resolve/main/web/src/lib/theme.ts
453 Bytes
| const KEY = "chatterbox.theme"; | |
| export type Theme = "light" | "dark"; | |
| export function getTheme(): Theme { | |
| const stored = localStorage.getItem(KEY) as Theme | null; | |
| if (stored === "light" || stored === "dark") return stored; | |
| return "dark"; | |
| } | |
| export function setTheme(t: Theme) { | |
| localStorage.setItem(KEY, t); | |
| document.documentElement.classList.toggle("dark", t === "dark"); | |
| } | |
| export function applyInitialTheme() { | |
| setTheme(getTheme()); | |
| } | |