Download web/theme-init.js from MHamdan/KCNA: direct link, hf CLI and curl.
- Browser
- Download file 453 Bytes
-
https://huggingface.co/spaces/MHamdan/KCNA/resolve/main/web/theme-init.js
- Command line
-
hf download hf://spaces/MHamdan/KCNA/web/theme-init.js
-
curl -L -o theme-init.js https://huggingface.co/spaces/MHamdan/KCNA/resolve/main/web/theme-init.js
453 Bytes
| // Applies the saved theme before first paint (external file so the CSP can forbid inline scripts). | |
| try { | |
| var t = JSON.parse(localStorage.getItem('kcna-progress-v1') || '{}').prefs; | |
| var theme = t && t.theme; | |
| var dark = theme === 'dark' || ((!theme || theme === 'system') && matchMedia('(prefers-color-scheme: dark)').matches); | |
| document.documentElement.classList.toggle('dark', dark); | |
| } catch { | |
| // storage unavailable: keep the default theme | |
| } | |