nexus-ai / static /theme.js
Jeetandar N Silwani
Initial Nexus AI release
7ee22ad
Raw History Blame Contribute Delete
514 Bytes
let theme = localStorage.getItem("nexus_theme") || "dark";
function applyTheme(t) {
theme = t;
document.body.className = t;
localStorage.setItem("nexus_theme", t);
}
document.addEventListener("DOMContentLoaded", async () => {
applyTheme(theme);
try {
const res = await fetch("/api/settings", { credentials: "include" });
if (res.ok) {
const data = await res.json();
if (data.settings && data.settings.theme) {
applyTheme(data.settings.theme);
}
}
} catch {}
});