mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-10 18:35:48 +08:00
Align Admin/Chat UI with NetX dark ops shell.
Add a netx theme preset as the default, variable-drive chrome styles, and keep legacy DeepSeek/other palettes available. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
e4b7b8d12e
commit
cbd9942b0b
7 changed files with 317 additions and 90 deletions
|
|
@ -1,29 +1,32 @@
|
|||
/* Admin + standalone /chat: restore palette from localStorage before first paint. */
|
||||
(function () {
|
||||
const STORAGE_KEY = "oclaw_admin_theme";
|
||||
const THEMES = ["deepseek", "github", "nord", "dracula", "forest", "catppuccin", "light"];
|
||||
const DEFAULT_THEME = "netx";
|
||||
const THEMES = ["netx", "deepseek", "github", "nord", "dracula", "forest", "catppuccin", "light"];
|
||||
const LEGIT = new Set(THEMES);
|
||||
|
||||
function applyAdminTheme(theme) {
|
||||
const t = theme && LEGIT.has(theme) ? theme : "deepseek";
|
||||
const t = theme && LEGIT.has(theme) ? theme : DEFAULT_THEME;
|
||||
if (t === "deepseek") document.body.removeAttribute("data-admin-theme");
|
||||
else document.body.setAttribute("data-admin-theme", t);
|
||||
}
|
||||
|
||||
function initAdminThemeFromStorage() {
|
||||
let raw = "deepseek";
|
||||
let raw = DEFAULT_THEME;
|
||||
try {
|
||||
raw = localStorage.getItem(STORAGE_KEY) || "deepseek";
|
||||
const stored = localStorage.getItem(STORAGE_KEY);
|
||||
// Missing key → netx. Existing deepseek/github/… prefs are preserved.
|
||||
raw = stored == null || stored === "" ? DEFAULT_THEME : stored;
|
||||
} catch (_) {
|
||||
raw = "deepseek";
|
||||
raw = DEFAULT_THEME;
|
||||
}
|
||||
if (!LEGIT.has(raw)) raw = "deepseek";
|
||||
if (!LEGIT.has(raw)) raw = DEFAULT_THEME;
|
||||
applyAdminTheme(raw);
|
||||
return raw;
|
||||
}
|
||||
|
||||
function persistAdminTheme(theme) {
|
||||
const t = theme && LEGIT.has(theme) ? theme : "deepseek";
|
||||
const t = theme && LEGIT.has(theme) ? theme : DEFAULT_THEME;
|
||||
try {
|
||||
localStorage.setItem(STORAGE_KEY, t);
|
||||
} catch (_) {}
|
||||
|
|
@ -33,14 +36,16 @@
|
|||
function currentAdminTheme() {
|
||||
try {
|
||||
const v = localStorage.getItem(STORAGE_KEY);
|
||||
return v && LEGIT.has(v) ? v : "deepseek";
|
||||
if (v == null || v === "") return DEFAULT_THEME;
|
||||
return LEGIT.has(v) ? v : DEFAULT_THEME;
|
||||
} catch (_) {
|
||||
return "deepseek";
|
||||
return DEFAULT_THEME;
|
||||
}
|
||||
}
|
||||
|
||||
window.OclawAdminTheme = {
|
||||
STORAGE_KEY,
|
||||
DEFAULT_THEME,
|
||||
THEMES,
|
||||
applyAdminTheme,
|
||||
initAdminThemeFromStorage,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue