Download backend/static/theme-toggle.js from luman-ai/app: direct link, hf CLI and curl.
- Browser
- Download file 1.03 kB
-
https://huggingface.co/spaces/luman-ai/app/resolve/main/backend/static/theme-toggle.js
- Command line
-
hf download hf://spaces/luman-ai/app/backend/static/theme-toggle.js
-
curl -L -o theme-toggle.js https://huggingface.co/spaces/luman-ai/app/resolve/main/backend/static/theme-toggle.js
1.03 kB
| (function () { | |
| var KEY = "neurobyte-theme"; | |
| function getStored() { | |
| try { | |
| return localStorage.getItem(KEY); | |
| } catch (e) { | |
| return null; | |
| } | |
| } | |
| function setTheme(theme) { | |
| if (theme !== "light" && theme !== "dark") theme = "dark"; | |
| document.documentElement.setAttribute("data-theme", theme); | |
| try { | |
| localStorage.setItem(KEY, theme); | |
| } catch (e) {} | |
| } | |
| function init() { | |
| var saved = getStored(); | |
| if (!saved) { | |
| saved = window.matchMedia("(prefers-color-scheme: dark)").matches | |
| ? "dark" | |
| : "light"; | |
| } | |
| setTheme(saved); | |
| document.querySelectorAll("[data-theme-toggle]").forEach(function (btn) { | |
| btn.addEventListener("click", function () { | |
| var cur = | |
| document.documentElement.getAttribute("data-theme") || "dark"; | |
| setTheme(cur === "dark" ? "light" : "dark"); | |
| }); | |
| }); | |
| } | |
| if (document.readyState === "loading") { | |
| document.addEventListener("DOMContentLoaded", init); | |
| } else { | |
| init(); | |
| } | |
| })(); |