/* * bot_theme_plugin.h -- SCORPIOX BOT theme tokens for node plugins. * * A trimmed copy of scorpiox-bot-web/bot_theme.h (the bot's single source of * truth for its dual theme). A plugin runs inside the bot (Hub modal, Session * Card modal, Chat floating window) or in its own tab, and in every case it * must look like part of the bot: same tokens, same dark/light pair, same * localStorage key, same prepaint order. * * Three rules, and nothing else: * * 1. Colours come from these tokens only. No plugin-private palette. * 2. The theme is decided BEFORE first paint, in this order: * ?theme=light|dark -> localStorage.bot_theme -> prefers-color-scheme * so a plugin opened from the bot paints in the bot's theme from frame 0. * 3. When the bot's theme changes it posts {type:'sx-theme',theme:'...'} into * this window; the plugin follows without a reload. The plugin asks once * with {type:'sx-theme-request'} at startup, which covers the case where * it was already open when the bot changed theme. * * The bottom of :root carries aliases for the names older plugin CSS already * uses (--surface, --surface2, --muted, --accent, --accent2, --danger, --warn, * --ok), so adopting the bot palette is a swap, not a redesign. Because they * are var() references, one definition covers both themes. * * MIT License. Copyright (c) 2026 SCORPIOX INC. */ #ifndef SX_BOT_THEME_PLUGIN_H #define SX_BOT_THEME_PLUGIN_H /* Dark is the default; light is applied by html[data-theme=light] (chosen by * ?theme= or the bot) or by prefers-color-scheme when nothing chose. */ #define SX_BOT_THEME_TOKENS \ ":root{color-scheme:dark;" \ "--bg:#000000;--bg-2:#08080a;--bg-card:#1c1c1e;" \ "--surface-2:rgba(255,255,255,.06);--surface-hover:rgba(255,255,255,.05);" \ "--line:rgba(255,255,255,.08);--line-2:rgba(255,255,255,.16);--border:rgba(255,255,255,.08);" \ "--text:#f5f5f7;--text-2:#86868b;--dim:#86868b;" \ "--blue:#0a84ff;--green:#30d158;--orange:#ff9f0a;--red:#ff453a;--gray:#8e8e93;" \ "--indigo:#5e5ce6;--teal:#64d2ff;--purple:#bf5af2;--yellow:#ffd60a;" \ "--input-bg:rgba(255,255,255,.04);--modal-bg:#1c1c1e;--menu-bg:#1c1c1e;--code-bg:rgba(255,255,255,.06);" \ "--mono:'SF Mono',ui-monospace,Menlo,Consolas,'DejaVu Sans Mono',monospace;" \ "--font:-apple-system,BlinkMacSystemFont,'SF Pro Display','SF Pro Text','Inter','Segoe UI',Roboto,Helvetica,Arial,sans-serif;" \ "--shadow:0 1px 2px rgba(0,0,0,.35);" \ "--shadow-lg:0 30px 80px rgba(0,0,0,.65),0 0 0 1px rgba(255,255,255,.04);" \ "--ease:cubic-bezier(.16,1,.3,1);" \ "--surface:var(--bg-card);--surface2:var(--surface-2);--muted:var(--text-2);" \ "--accent:var(--blue);--accent2:var(--green);--accent-dim:#0071e3;" \ "--danger:var(--red);--err:var(--red);--warn:var(--orange);--ok:var(--green);" \ "}" \ "@media (prefers-color-scheme:light){html:not([data-theme=dark]){" \ "--bg:#f5f5f7;--bg-2:#ffffff;--bg-card:#ffffff;" \ "--surface-2:rgba(0,0,0,.04);--surface-hover:#ffffff;" \ "--line:rgba(0,0,0,.06);--line-2:rgba(0,0,0,.12);--border:rgba(0,0,0,.06);" \ "--text:#1d1d1f;--text-2:#6e6e73;--dim:#6e6e73;" \ "--blue:#007aff;--green:#34c759;--orange:#ff9500;--red:#ff3b30;--gray:#8e8e93;" \ "--indigo:#5856d6;--teal:#32ade6;--purple:#af52de;--yellow:#b8860b;" \ "--accent-dim:#0066d6;" \ "--input-bg:#f5f5f7;--modal-bg:#ffffff;--menu-bg:#ffffff;--code-bg:rgba(0,0,0,.05);" \ "--shadow:0 2px 10px rgba(0,0,0,.03);" \ "--shadow-lg:0 30px 80px rgba(0,0,0,.18),0 0 0 1px rgba(0,0,0,.04);" \ "color-scheme:light}}" \ "html[data-theme=light]{" \ "--bg:#f5f5f7;--bg-2:#ffffff;--bg-card:#ffffff;" \ "--surface-2:rgba(0,0,0,.04);--surface-hover:#ffffff;" \ "--line:rgba(0,0,0,.06);--line-2:rgba(0,0,0,.12);--border:rgba(0,0,0,.06);" \ "--text:#1d1d1f;--text-2:#6e6e73;--dim:#6e6e73;" \ "--blue:#007aff;--green:#34c759;--orange:#ff9500;--red:#ff3b30;--gray:#8e8e93;" \ "--indigo:#5856d6;--teal:#32ade6;--purple:#af52de;--yellow:#b8860b;" \ "--accent-dim:#0066d6;" \ "--input-bg:#f5f5f7;--modal-bg:#ffffff;--menu-bg:#ffffff;--code-bg:rgba(0,0,0,.05);" \ "--shadow:0 2px 10px rgba(0,0,0,.03);" \ "--shadow-lg:0 30px 80px rgba(0,0,0,.18),0 0 0 1px rgba(0,0,0,.04);" \ "color-scheme:light}" \ "html{color-scheme:dark}html[data-theme=dark]{color-scheme:dark}" \ "*{box-sizing:border-box}" \ "body{margin:0;background:var(--bg);color:var(--text);font-family:var(--font);" \ "-webkit-font-smoothing:antialiased}" \ "button{font-family:inherit;letter-spacing:inherit}" \ "button:active{transform:scale(.98)}" \ "select option{background:var(--menu-bg);color:var(--text)}" \ "a{color:var(--blue);text-decoration:none;font-weight:600}" \ "/* Embed mode (?embed=1): the host owns the title and the theme, so the plugin" \ " * hides its own back link and its own toggle. */" \ "html.embedded .embed-hide,html.embedded #themeToggle{display:none!important}" \ "@media(prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}" /* Pre-paint: decide the theme before the first frame. Must be the first thing * in so there is no flash of the wrong theme. Also flags embed mode as * html.embedded so the embed rules apply before first paint. */ #define SX_BOT_THEME_PREPAINT \ "\n" /* Handoff: follow the bot. The host posts {type:'sx-theme',theme}; we ask once * at startup in case it changed while this page was already open. Fires the * same 'bot-theme' CustomEvent the bot pages use, so canvas surfaces can * re-skin themselves from one listener. */ #define SX_BOT_THEME_HANDOFF \ "\n" /* Standalone toggle (hidden in embed mode by the CSS above). Only useful when * the plugin is opened in its own tab; inside the bot the host owns the theme. * Give it class 'icon-btn'-free styling from the page, or use the helper JS. */ #define SX_BOT_THEME_TOGGLE_BTN \ "" #define SX_BOT_THEME_TOGGLE_JS \ "\n" #endif /* SX_BOT_THEME_PLUGIN_H */