vitepress-theme-tui
Version:
A terminal UI theme for VitePress
2 lines (1 loc) • 830 B
JavaScript
;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=[{name:"plain",label:"Plain"},{name:"default",label:"Default"},{name:"monokai",label:"Monokai"}],l=n.map(e=>e.name);function s(){if(typeof document>"u")return"default";const e=document.documentElement;for(const t of n)if(e.classList.contains(t.className))return t.name;return"default"}function a(e){if(typeof document>"u")return!1;l.includes(e)||console.warn(`Theme "${e}" not found. Available themes: ${l.join(", ")}`);const t=document.documentElement;return t.classList.remove(...Array.from(t.classList).filter(o=>o.startsWith("tui-theme-"))),t.classList.add(`tui-theme-${e}`),localStorage.setItem("vp-tui-theme",e),!0}function u({theme:e}={}){a(e||"default")}exports.getCurrentTheme=s;exports.setTheme=a;exports.themes=n;exports.useTUI=u;