async function applyStyle(path, name) { const res = await fetch(`${path}/${encodeURIComponent(name)}`); if (!res.ok) return false; for (const [key, value] of Object.entries(await res.json())) { document.documentElement.style.setProperty(`--${key}`, value); } return true; } window.setStyle = (path, name) => applyStyle(path, name); window.setTheme = (name) => applyStyle("/theme", name); window.setFontPack = (name) => applyStyle("/font-pack", name);