Spaces:
Running
Running
Download src/lib/switchTheme.ts from huggingchat/chat-ui: direct link, hf CLI and curl.
- Browser
- Download file 474 Bytes
-
https://huggingface.co/spaces/huggingchat/chat-ui/resolve/refs%2Fpr%2F511/src/lib/switchTheme.ts
- Command line
-
hf download hf://spaces/huggingchat/chat-ui@refs/pr/511/src/lib/switchTheme.ts
-
curl -L -o switchTheme.ts https://huggingface.co/spaces/huggingchat/chat-ui/resolve/refs%2Fpr%2F511/src/lib/switchTheme.ts
474 Bytes
| export function switchTheme() { | |
| const { classList } = document.querySelector("html") as HTMLElement; | |
| const metaTheme = document.querySelector('meta[name="theme-color"]') as HTMLMetaElement; | |
| if (classList.contains("dark")) { | |
| classList.remove("dark"); | |
| metaTheme.setAttribute("content", "rgb(249, 250, 251)"); | |
| localStorage.theme = "light"; | |
| } else { | |
| classList.add("dark"); | |
| metaTheme.setAttribute("content", "rgb(26, 36, 50)"); | |
| localStorage.theme = "dark"; | |
| } | |
| } | |