Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

feat(theme): reimagined theme system with full design tokens + 4 named themes

Adam Eivy258504f812d1
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 3729b54398..c2ae63aef7 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -2,6 +2,7 @@
## Added
+- **Reimagined theme system — four named themes with full design tokens.** Replaced the five ad-hoc color-only themes (Midnight, Phosphor, Ember, Arctic, Synthwave) with a structured manifest of four themes that each carry a complete design system, not just a color palette: **Classic Midnight** (the existing baseline, kept stable), **Lumen Glass** (translucent glass panes with backdrop-blur), **Black ICE Terminal** (dense cyberpunk terminal with scanlines and monospace UI), and **Blueprint Ops** (drafting-grid systems-map aesthetic). Each theme manifest declares colors (`--port-bg`, `--port-card`, etc), per-channel "on-X" foreground colors for accessible contrast on accent/success/warning/error pills, and a tokens block covering radii, font stacks (UI/display/mono), motion durations, shadow variants, backdrop-filter, body gradient/texture, control surfaces, hover/active states, terminal styling, and chart colors. A new runtime layer in `client/src/index.css` keys off `html[data-port-theme="<id>"]` so theme switches restyle the entire UI in one paint — including transitions on inputs/buttons, toaster border/shadow tokens (`client/src/main.jsx`), per-theme card backgrounds, sidebar treatments, and theme-specific flourishes (Black ICE scanline overlay, Blueprint Ops grid-pattern card backgrounds + heading rules, Lumen Glass focus glows). The theme picker has two surfaces: a redesigned dropdown in the bottom-bar `ThemeSwitcher` (portal-rendered, viewport-clamped, rAF-throttled scroll/resize repositioning, with family icons + accent swatch) and a new card-grid `ThemePickerPanel` in Settings → General that shows each theme's concept, density, four-color swatch row, and an active-state check. Legacy theme ids stored in `localStorage` or server settings are normalized via `LEGACY_THEME_ALIASES` (`midnight` → `classic-midnight`, `phosphor`/`synthwave` → `black-ice-terminal`, `arctic` → `lumen-glass`, `ember` → `blueprint-ops`) so existing users don't lose their preference; the migrated id is written back so future loads are direct. A new `npm run theme:check` script (`scripts/check-themes.js`, runs at any time) enforces the theme contract: every theme must declare every required color/token var with valid RGB channels, must point at a doc under `docs/themes/<id>.md` containing the four required sections (`## Intent`, `## Integration Rules`, `## Component Notes`, `## Validation`), every legacy alias must resolve to a real theme, and `index.css` must include a theme-specific selector for each non-default theme. Files: `client/src/themes/portosThemes.js` (new), `client/src/themes/familyIcons.js` (new), `client/src/components/ThemePickerPanel.jsx` (new), `client/src/components/ThemeSwitcher.jsx`, `client/src/components/ThemeContext.jsx`, `client/src/components/settings/GeneralTab.jsx`, `client/src/hooks/useTheme.js`, `client/src/index.css`, `client/src/main.jsx`, `docs/themes/*.md` (new — one per theme + README), `scripts/check-themes.js` (new), `package.json` (new `theme:check` script).
- **3D Chief of Staff avatars are draggable to re-orient.** All five 3D avatar styles (Cyber, Sigil, Esoteric, Nexus, Muse) now respond to typical mouse/touch drag controls — click-and-drag rotates the avatar around its center, with damping for a smooth feel. Pan and zoom are intentionally disabled so the framing stays consistent on the small avatar tile. Wrapper divs use `cursor-grab`/`active:cursor-grabbing` and `touch-none` so the affordance is visible and touch drags don't fight page scroll. Implemented via drei's `OrbitControls` inside each avatar's `<Scene>`. Files: `client/src/components/cos/CyberCoSAvatar.jsx`, `client/src/components/cos/SigilCoSAvatar.jsx`, `client/src/components/cos/EsotericCoSAvatar.jsx`, `client/src/components/cos/NexusCoSAvatar.jsx`, `client/src/components/cos/MuseCoSAvatar.jsx`.
- **Live AI operation status — toasts + server logs for every model call.** The user had no idea when a feature like Digital Twin → Taste → "Generate Summary" was actually doing work versus hung; the button just animated and silently waited up to a minute while LM Studio loaded a model on demand. New `server/services/aiStatusEvents.js` exports an `EventEmitter` + `startAIOp({ op, label, providerId, providerName, model })` helper that emits phase-tagged events (`start`, `model:loading`, `model:loaded`, `complete`, `error`) with provider/model/op metadata. `server/services/socket.js` bridges the emitter onto a new `ai:status` Socket.IO channel broadcast to all clients. `server/lib/aiProvider.js` — `callProviderAISimple()` now starts a status op for every API call (logs always; toasts when the caller passes `op`/`opLabel`, plus model-loading/error always), and the LM Studio auto-load path emits `model:loading` ("Loading openai/gpt-oss-20b into LM Studio…") + `model:loaded` ("openai/gpt-oss-20b loaded (4.2s)") so the user sees what's happening instead of a frozen button. `server/services/taste-questionnaire.js` passes labeled ops for the three taste AI calls (section summary, overall summary, deeper personalized question) so toasts read "Generating Movies & Film taste summary…" rather than a generic provider name. New `client/src/hooks/useAIStatusNotifications.js` subscribes to `ai:status`, renders one mutating toast per op id (`toast.loading` → `toast.success`/`toast.error` with the same id so phases update the same toast), and is mounted globally in `client/src/components/Layout.jsx`. Silent (uninstrumented) ops only toast when something user-visible happens (model load, error, or call exceeds 2.5s) so background calls don't spam the UI; explicit user-triggered ops toast immediately. Server logs are single-line emoji-prefixed with op slug, phase, message, provider, model, and elapsed time per CLAUDE.md style. Files: `server/services/aiStatusEvents.js` (new), `server/lib/aiProvider.js`, `server/services/socket.js`, `server/services/taste-questionnaire.js`, `client/src/hooks/useAIStatusNotifications.js` (new), `client/src/components/Layout.jsx`.
@@ -19,6 +20,7 @@
## Changed
+- **Vite dev proxy splits `/data` into per-subpath rules.** Replaced the single catch-all `/data` proxy with explicit `/data/images`, `/data/videos`, and `/data/video-thumbnails` entries so app-managed `data/` directories (CoS state, plans, etc.) are served by Vite from disk instead of being silently round-tripped to the API server. File: `client/vite.config.js`.
- **Send to Video carries the source image's prompts.** Clicking "Send to Video" on an Image Gen result, gallery card, or lightbox — or the same action from Media History — now pre-populates the Video Gen prompt and negative prompt from the source image's metadata. Previously only the source image filename was passed, leaving the user to retype or paste the prompt to keep the same scene direction. The flow piggybacks on the existing `?sourceImageFile=` query-param hand-off: `?prompt=` and `?negativePrompt=` are added when the source has them, and `VideoGen.jsx` reads both on first render and re-syncs on subsequent navigations (mirroring the existing source-image effect). Files: `client/src/pages/ImageGen.jsx`, `client/src/pages/MediaHistory.jsx`, `client/src/pages/VideoGen.jsx`.
## Fixed
diff --git a/client/src/components/ThemeContext.jsx b/client/src/components/ThemeContext.jsx
index 21ded29dd4..4c9874b97c 100644
--- a/client/src/components/ThemeContext.jsx
+++ b/client/src/components/ThemeContext.jsx
@@ -1,5 +1,13 @@
import { createContext, useContext } from 'react';
import useTheme from '../hooks/useTheme';
+import { DEFAULT_THEME_ID, THEMES, THEME_LIST } from '../themes/portosThemes';
+
+const FALLBACK_CONTEXT = {
+ themeId: DEFAULT_THEME_ID,
+ theme: THEMES[DEFAULT_THEME_ID],
+ themeList: THEME_LIST,
+ setTheme: () => {},
+};
const ThemeContext = createContext(null);
@@ -14,7 +22,5 @@ export function ThemeProvider({ children }) {
}
export function useThemeContext() {
- const ctx = useContext(ThemeContext);
- if (!ctx) return { themeId: 'midnight', theme: null, themes: {}, setTheme: () => {} };
- return ctx;
+ return useContext(ThemeContext) ?? FALLBACK_CONTEXT;
}
diff --git a/client/src/components/ThemePickerPanel.jsx b/client/src/components/ThemePickerPanel.jsx
new file mode 100644
index 0000000000..03e02ed9ba
--- /dev/null
+++ b/client/src/components/ThemePickerPanel.jsx
@@ -0,0 +1,64 @@
+import { Check } from 'lucide-react';
+import { useThemeContext } from './ThemeContext';
+import { getFamilyIcon } from '../themes/familyIcons';
+
+export default function ThemePickerPanel({ compact = false }) {
+ const { themeId, themeList, setTheme } = useThemeContext();
+
+ return (
+ <div className={compact ? 'grid gap-2' : 'grid gap-3 sm:grid-cols-2 xl:grid-cols-4'}>
+ {themeList.map(theme => {
+ const Icon = getFamilyIcon(theme.family);
+ const active = theme.id === themeId;
+ return (
+ <button
+ key={theme.id}
+ type="button"
+ onClick={() => setTheme(theme.id)}
+ aria-pressed={active}
+ className={`group text-left border transition-colors ${
+ compact ? 'rounded-lg p-3' : 'rounded-xl p-4'
+ } ${
+ active
+ ? 'bg-port-accent/10 border-port-accent/60 text-white'
+ : 'bg-port-card border-port-border text-gray-300 hover:text-white hover:border-port-accent/50'
+ }`}
+ >
+ <div className="flex items-start justify-between gap-3">
+ <div className="flex items-center gap-2 min-w-0">
+ <span className="inline-flex items-center justify-center w-8 h-8 rounded-lg bg-port-bg border border-port-border text-port-accent shrink-0">
+ <Icon size={16} />
+ </span>
+ <div className="min-w-0">
+ <div className="font-semibold truncate">{theme.label}</div>
+ <div className="text-xs text-gray-500 capitalize">{theme.density}</div>
+ </div>
+ </div>
+ {active && (
+ <span className="inline-flex items-center justify-center w-5 h-5 rounded-full bg-port-accent text-white shrink-0">
+ <Check size={13} />
+ </span>
+ )}
+ </div>
+
+ {!compact && (
+ <p className="mt-3 text-sm text-gray-400 line-clamp-3 min-h-[60px]">
+ {theme.concept}
+ </p>
+ )}
+
+ <div className="mt-3 flex items-center gap-1.5">
+ {theme.swatches.map(color => (
+ <span
+ key={color}
+ className="h-4 flex-1 rounded border border-white/15"
+ style={{ backgroundColor: color }}
+ />
+ ))}
+ </div>
+ </button>
+ );
+ })}
+ </div>
+ );
+}
diff --git a/client/src/components/ThemeSwitcher.jsx b/client/src/components/ThemeSwitcher.jsx
index 5638382e48..6f83c41f20 100644
--- a/client/src/components/ThemeSwitcher.jsx
+++ b/client/src/components/ThemeSwitcher.jsx
@@ -1,69 +1,157 @@
-import { useState, useRef, useEffect } from 'react';
-import { Palette } from 'lucide-react';
+import { useState, useRef, useEffect, useLayoutEffect, useCallback } from 'react';
+import { createPortal } from 'react-dom';
+import { Check, Palette } from 'lucide-react';
import { useThemeContext } from './ThemeContext';
+import { getFamilyIcon } from '../themes/familyIcons';
+
+const MENU_WIDTH = 288;
+const MENU_GAP = 8;
+const VIEWPORT_PADDING = 8;
export default function ThemeSwitcher({ position = 'above', className = '' }) {
- const { themeId, themes, setTheme } = useThemeContext();
+ const { themeId, theme, themeList, setTheme } = useThemeContext();
const [open, setOpen] = useState(false);
+ const [menuStyle, setMenuStyle] = useState(null);
const containerRef = useRef(null);
+ const triggerRef = useRef(null);
+ const menuRef = useRef(null);
- // Close on click outside
- useEffect(() => {
- if (!open) return;
- const handle = (e) => {
- if (containerRef.current && !containerRef.current.contains(e.target)) {
- setOpen(false);
+ const updateMenuPosition = useCallback(() => {
+ const trigger = triggerRef.current;
+ const menu = menuRef.current;
+ if (!trigger || !menu) return;
+
+ const triggerRect = trigger.getBoundingClientRect();
+ const menuRect = menu.getBoundingClientRect();
+ const viewportWidth = window.innerWidth;
+ const viewportHeight = window.innerHeight;
+ const width = Math.min(MENU_WIDTH, Math.max(180, viewportWidth - VIEWPORT_PADDING * 2));
+ const maxLeft = viewportWidth - width - VIEWPORT_PADDING;
+ const left = Math.min(
+ Math.max(triggerRect.right - width, VIEWPORT_PADDING),
+ Math.max(VIEWPORT_PADDING, maxLeft)
+ );
+
+ const aboveTop = triggerRect.top - menuRect.height - MENU_GAP;
+ const belowTop = triggerRect.bottom + MENU_GAP;
+ const wouldOverflowTop = aboveTop < VIEWPORT_PADDING;
+ const wouldOverflowBottom = belowTop + menuRect.height > viewportHeight - VIEWPORT_PADDING;
+
+ let top = position === 'above'
+ ? (wouldOverflowTop ? belowTop : aboveTop)
+ : (wouldOverflowBottom ? aboveTop : belowTop);
+
+ const maxTop = Math.max(VIEWPORT_PADDING, viewportHeight - menuRect.height - VIEWPORT_PADDING);
+ top = Math.min(Math.max(top, VIEWPORT_PADDING), maxTop);
+
+ setMenuStyle(prev => {
+ if (prev && prev.left === `${left}px` && prev.top === `${top}px` && prev.width === `${width}px`) {
+ return prev;
}
- };
- document.addEventListener('mousedown', handle);
- return () => document.removeEventListener('mousedown', handle);
- }, [open]);
+ return { left: `${left}px`, top: `${top}px`, width: `${width}px` };
+ });
+ }, [position]);
- // Close on Escape
useEffect(() => {
- if (!open) return;
- const handle = (e) => e.key === 'Escape' && setOpen(false);
- document.addEventListener('keydown', handle);
- return () => document.removeEventListener('keydown', handle);
- }, [open]);
+ if (!open) return undefined;
+
+ const onMouseDown = (e) => {
+ const clickedTrigger = containerRef.current?.contains(e.target);
+ const clickedMenu = menuRef.current?.contains(e.target);
+ if (!clickedTrigger && !clickedMenu) setOpen(false);
+ };
+
+ const onKeyDown = (e) => {
+ if (e.key === 'Escape') setOpen(false);
+ };
+
+ let rafId = null;
+ const onReposition = () => {
+ if (rafId !== null) return;
+ rafId = requestAnimationFrame(() => {
+ rafId = null;
+ updateMenuPosition();
+ });
+ };
+
+ document.addEventListener('mousedown', onMouseDown);
+ document.addEventListener('keydown', onKeyDown);
+ window.addEventListener('resize', onReposition);
+ window.addEventListener('scroll', onReposition, true);
+
+ return () => {
+ if (rafId !== null) cancelAnimationFrame(rafId);
+ document.removeEventListener('mousedown', onMouseDown);
+ document.removeEventListener('keydown', onKeyDown);
+ window.removeEventListener('resize', onReposition);
+ window.removeEventListener('scroll', onReposition, true);
+ };
+ }, [open, updateMenuPosition]);
+
+ useLayoutEffect(() => {
+ if (!open) {
+ setMenuStyle(null);
+ return;
+ }
+ updateMenuPosition();
+ }, [open, updateMenuPosition]);
return (
<div ref={containerRef} className={`relative ${className}`}>
<button
+ ref={triggerRef}
onClick={() => setOpen(!open)}
className="p-1.5 text-gray-500 hover:text-port-accent transition-colors"
title="Switch theme"
- aria-label="Switch theme"
+ aria-label={`Switch theme. Current theme: ${theme?.label ?? 'Classic Midnight'}`}
aria-expanded={open}
>
<Palette size={18} />
</button>
- {open && (
+ {open && createPortal(
<div
- className={`absolute ${
- position === 'above' ? 'bottom-full mb-2' : 'top-full mt-2'
- } right-0 w-44 bg-port-card border border-port-border rounded-lg shadow-xl z-50 py-1`}
+ ref={menuRef}
+ className="fixed max-w-[calc(100vw-1rem)] bg-port-card border border-port-border rounded-xl shadow-xl z-[100] p-2"
+ style={{
+ left: menuStyle?.left ?? `${VIEWPORT_PADDING}px`,
+ top: menuStyle?.top ?? `${VIEWPORT_PADDING}px`,
+ width: menuStyle?.width ?? `${MENU_WIDTH}px`,
+ visibility: menuStyle ? 'visible' : 'hidden',
+ }}
>
- {Object.entries(themes).map(([id, theme]) => (
- <button
- key={id}
- onClick={() => { setTheme(id); setOpen(false); }}
- className={`w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors ${
- themeId === id
- ? 'bg-port-accent/10 text-port-accent'
- : 'text-gray-400 hover:text-white hover:bg-port-border/50'
- }`}
- >
- <span
- className="w-3 h-3 rounded-full shrink-0 border border-white/20"
- style={{ backgroundColor: theme.accent }}
- />
- {theme.label}
- {themeId === id && <span className="ml-auto text-xs opacity-60">Active</span>}
- </button>
- ))}
- </div>
+ <div className="px-2 py-1.5 text-xs font-medium uppercase text-gray-500">
+ Interface theme
+ </div>
+ <div className="space-y-1">
+ {themeList.map(option => {
+ const Icon = getFamilyIcon(option.family);
+ const active = themeId === option.id;
+ return (
+ <button
+ key={option.id}
+ onClick={() => { setTheme(option.id); setOpen(false); }}
+ className={`w-full flex items-center gap-3 px-2.5 py-2.5 rounded-lg text-sm transition-colors ${
+ active
+ ? 'bg-port-accent/10 text-port-accent'
+ : 'text-gray-400 hover:text-white hover:bg-port-border/50'
+ }`}
+ >
+ <span className="relative w-8 h-8 rounded-lg border border-port-border bg-port-bg shrink-0 overflow-hidden flex items-center justify-center">
+ <span className="absolute inset-x-0 bottom-0 h-2" style={{ backgroundColor: option.accent }} />
+ <Icon size={16} className="relative" />
+ </span>
+ <span className="min-w-0 flex-1 text-left">
+ <span className="block font-medium truncate">{option.label}</span>
+ <span className="block text-xs text-gray-500 truncate">{option.shortLabel} - {option.density}</span>
+ </span>
+ {active && <Check size={16} className="shrink-0" />}
+ </button>
+ );
+ })}
+ </div>
+ </div>,
+ document.body
)}
</div>
);
diff --git a/client/src/components/settings/GeneralTab.jsx b/client/src/components/settings/GeneralTab.jsx
index 81f9b2942a..35a0e6b85f 100644
--- a/client/src/components/settings/GeneralTab.jsx
+++ b/client/src/components/settings/GeneralTab.jsx
@@ -2,6 +2,7 @@ import { useState, useEffect, useMemo } from 'react';
import { Save } from 'lucide-react';
import toast from '../ui/Toast';
import BrailleSpinner from '../BrailleSpinner';
+import ThemePickerPanel from '../ThemePickerPanel';
import { getSettings, updateSettings } from '../../services/api';
export function GeneralTab() {
@@ -56,6 +57,11 @@ export function GeneralTab() {
return (
<div className="space-y-6">
+ <div className="bg-port-card border border-port-border rounded-lg p-6">
+ <h3 className="text-lg font-semibold text-white mb-4">Interface Theme</h3>
+ <ThemePickerPanel />
+ </div>
+
<div className="bg-port-card border border-port-border rounded-lg p-6">
<h3 className="text-lg font-semibold text-white mb-4">Timezone</h3>
<p className="text-sm text-gray-400 mb-4">
diff --git a/client/src/hooks/useTheme.js b/client/src/hooks/useTheme.js
index c3e9cc63dc..d621e7e03a 100644
--- a/client/src/hooks/useTheme.js
+++ b/client/src/hooks/useTheme.js
@@ -1,106 +1,34 @@
import { useState, useCallback, useEffect } from 'react';
+import {
+ THEMES,
+ THEME_LIST,
+ getTheme,
+ normalizeThemeId,
+} from '../themes/portosThemes';
const STORAGE_KEY = 'portos-theme';
-// RGB channel values (space-separated) for Tailwind opacity modifier compatibility
-const THEMES = {
- midnight: {
- label: 'Midnight',
- accent: '#3b82f6',
- colors: {
- '--port-bg': '15 15 15',
- '--port-card': '26 26 26',
- '--port-border': '42 42 42',
- '--port-accent': '59 130 246',
- '--port-success': '34 197 94',
- '--port-warning': '245 158 11',
- '--port-error': '239 68 68',
- '--port-text': '229 229 229',
- '--port-text-muted': '163 163 163',
- '--port-focus-ring': '59 130 246',
- },
- },
- phosphor: {
- label: 'Phosphor',
- accent: '#22c55e',
- colors: {
- '--port-bg': '10 15 10',
- '--port-card': '18 28 18',
- '--port-border': '30 50 30',
- '--port-accent': '34 197 94',
- '--port-success': '74 222 128',
- '--port-warning': '250 204 21',
- '--port-error': '248 113 113',
- '--port-text': '200 230 200',
- '--port-text-muted': '130 170 130',
- '--port-focus-ring': '34 197 94',
- },
- },
- ember: {
- label: 'Ember',
- accent: '#f97316',
- colors: {
- '--port-bg': '18 12 10',
- '--port-card': '30 22 18',
- '--port-border': '55 38 28',
- '--port-accent': '249 115 22',
- '--port-success': '34 197 94',
- '--port-warning': '251 191 36',
- '--port-error': '239 68 68',
- '--port-text': '235 220 210',
- '--port-text-muted': '180 150 130',
- '--port-focus-ring': '249 115 22',
- },
- },
- arctic: {
- label: 'Arctic',
- accent: '#38bdf8',
- colors: {
- '--port-bg': '12 15 20',
- '--port-card': '20 26 35',
- '--port-border': '35 45 60',
- '--port-accent': '56 189 248',
- '--port-success': '34 197 94',
- '--port-warning': '245 158 11',
- '--port-error': '248 113 113',
- '--port-text': '210 225 240',
- '--port-text-muted': '140 160 185',
- '--port-focus-ring': '56 189 248',
- },
- },
- synthwave: {
- label: 'Synthwave',
- accent: '#c084fc',
- colors: {
- '--port-bg': '16 10 20',
- '--port-card': '28 18 35',
- '--port-border': '50 32 60',
- '--port-accent': '192 132 252',
- '--port-success': '74 222 128',
- '--port-warning': '251 191 36',
- '--port-error': '251 113 133',
- '--port-text': '230 215 240',
- '--port-text-muted': '170 140 190',
- '--port-focus-ring': '192 132 252',
- },
- },
-};
-
const applyTheme = (id) => {
- const theme = THEMES[id] ?? THEMES.midnight;
+ const theme = getTheme(id);
const style = document.documentElement.style;
- for (const [prop, value] of Object.entries(theme.colors)) {
+ const vars = { ...theme.colors, ...theme.tokens };
+ for (const [prop, value] of Object.entries(vars)) {
style.setProperty(prop, value);
}
+ document.documentElement.dataset.portTheme = theme.id;
+ document.documentElement.dataset.portThemeFamily = theme.family;
+ document.documentElement.dataset.portThemeDensity = theme.density;
+ document.documentElement.style.colorScheme = theme.colorScheme ?? 'dark';
+ return theme.id;
};
const loadTheme = () => {
const saved = localStorage.getItem(STORAGE_KEY);
- return saved && THEMES[saved] ? saved : 'midnight';
+ const normalized = normalizeThemeId(saved);
+ if (saved && saved !== normalized) localStorage.setItem(STORAGE_KEY, normalized);
+ return normalized;
};
-export { THEMES, applyTheme };
-
export default function useTheme() {
const [themeId, setThemeId] = useState(() => {
const id = loadTheme();
@@ -108,33 +36,31 @@ export default function useTheme() {
return id;
});
- // On mount, fetch server-side theme and apply if different from localStorage
useEffect(() => {
fetch('/api/settings')
.then(r => r.ok ? r.json() : null)
.then(settings => {
- const serverTheme = settings?.theme;
- if (serverTheme && THEMES[serverTheme] && serverTheme !== themeId) {
+ const serverTheme = settings?.theme ? normalizeThemeId(settings.theme) : null;
+ if (serverTheme && serverTheme !== themeId) {
localStorage.setItem(STORAGE_KEY, serverTheme);
applyTheme(serverTheme);
setThemeId(serverTheme);
}
})
- .catch(() => console.log('⚠️ Theme fetch failed, using localStorage fallback'));
+ .catch(() => console.log('Theme fetch failed, using localStorage fallback'));
}, []); // eslint-disable-line react-hooks/exhaustive-deps
const setTheme = useCallback((id) => {
- if (!THEMES[id]) return;
- localStorage.setItem(STORAGE_KEY, id);
- applyTheme(id);
- setThemeId(id);
- // Persist to server (fire-and-forget)
+ const normalized = normalizeThemeId(id);
+ localStorage.setItem(STORAGE_KEY, normalized);
+ applyTheme(normalized);
+ setThemeId(normalized);
fetch('/api/settings', {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
- body: JSON.stringify({ theme: id }),
- }).catch(() => console.warn('⚠️ Theme sync to server failed'));
+ body: JSON.stringify({ theme: normalized }),
+ }).catch(() => console.warn('Theme sync to server failed'));
}, []);
- return { themeId, theme: THEMES[themeId], themes: THEMES, setTheme };
+ return { themeId, theme: THEMES[themeId], themeList: THEME_LIST, setTheme };
}
diff --git a/client/src/index.css b/client/src/index.css
index 9ee680ee31..9083672a60 100644
--- a/client/src/index.css
+++ b/client/src/index.css
@@ -8,11 +8,13 @@
--color-port-success: rgb(var(--port-success));
--color-port-warning: rgb(var(--port-warning));
--color-port-error: rgb(var(--port-error));
+ --color-port-text: rgb(var(--port-text));
+ --color-port-text-muted: rgb(var(--port-text-muted));
--animate-scanline: scanline 5s linear infinite;
}
-/* Default theme CSS vars (Midnight) — overridden by JS on load */
+/* Default theme CSS vars (Classic Midnight) - overridden by JS on load */
:root {
--port-bg: 15 15 15;
--port-card: 26 26 26;
@@ -21,9 +23,54 @@
--port-success: 34 197 94;
--port-warning: 245 158 11;
--port-error: 239 68 68;
+ --port-on-accent: 255 255 255;
+ --port-on-success: 255 255 255;
+ --port-on-warning: 17 24 39;
+ --port-on-error: 255 255 255;
--port-text: 229 229 229;
--port-text-muted: 163 163 163;
+ --port-control-text: 212 212 216;
--port-focus-ring: 59 130 246;
+ --port-bg-alpha: 1;
+ --port-card-alpha: 1;
+ --port-border-alpha: 1;
+ --port-sidebar-alpha: 1;
+ --port-overlay-alpha: 0.72;
+ --port-panel-padding-scale: 1;
+ --port-radius-sm: 0.25rem;
+ --port-radius-md: 0.375rem;
+ --port-radius-lg: 0.5rem;
+ --port-radius-xl: 0.75rem;
+ --port-radius-pill: 9999px;
+ --port-font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
+ --port-font-display: var(--port-font-ui);
+ --port-font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
+ --port-motion-fast: 120ms;
+ --port-motion-medium: 220ms;
+ --port-motion-slow: 420ms;
+ --port-shadow-card: none;
+ --port-shadow-elevated: 0 18px 45px rgb(0 0 0 / 0.35);
+ --port-shadow-interactive: none;
+ --port-backdrop-filter: none;
+ --port-border-style: solid;
+ --port-body-gradient: none;
+ --port-body-texture: none;
+ --port-body-overlay-opacity: 0;
+ --port-app-backdrop: rgb(var(--port-bg));
+ --port-sidebar-bg: rgb(var(--port-card));
+ --port-input-bg: rgb(var(--port-bg));
+ --port-control-bg: rgb(var(--port-border));
+ --port-control-bg-hover: rgb(64 64 64);
+ --port-control-border: rgb(var(--port-border));
+ --port-active-bg: rgb(var(--port-accent) / 0.1);
+ --port-hover-bg: rgb(var(--port-border) / 0.5);
+ --port-terminal-bg: rgb(7 7 7);
+ --port-terminal-text: rgb(229 229 229);
+ --port-chart-1: 59 130 246;
+ --port-chart-2: 34 197 94;
+ --port-chart-3: 245 158 11;
+ --port-chart-4: 236 72 153;
+ --port-chart-grid: 64 64 64;
}
/* Geist Pixel font for CyberCity */
@@ -60,7 +107,11 @@ html, body, #root {
body {
background-color: rgb(var(--port-bg));
color: rgb(var(--port-text));
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
+ background-image: var(--port-body-texture), var(--port-body-gradient);
+ background-attachment: fixed;
+ background-size: 28px 28px, cover;
+ font-family: var(--port-font-ui);
+ letter-spacing: 0;
}
#root {
@@ -68,6 +119,255 @@ body {
min-height: 100dvh;
}
+body::before {
+ content: "";
+ position: fixed;
+ inset: 0;
+ z-index: -1;
+ pointer-events: none;
+ background-image: var(--port-body-texture), var(--port-body-gradient);
+ background-size: 28px 28px, cover;
+ opacity: var(--port-body-overlay-opacity);
+}
+
+html[data-port-theme] body,
+html[data-port-theme] button,
+html[data-port-theme] input,
+html[data-port-theme] textarea,
+html[data-port-theme] select {
+ font-family: var(--port-font-ui);
+}
+
+html[data-port-theme] .font-mono,
+html[data-port-theme] pre,
+html[data-port-theme] code,
+html[data-port-theme] kbd {
+ font-family: var(--port-font-mono);
+}
+
+html[data-port-theme] h1,
+html[data-port-theme] h2,
+html[data-port-theme] h3 {
+ font-family: var(--port-font-display);
+ letter-spacing: 0;
+}
+
+html[data-port-theme] .bg-port-bg {
+ background-color: rgb(var(--port-bg) / var(--port-bg-alpha)) !important;
+}
+
+html[data-port-theme] .bg-port-card,
+html[data-port-theme] [class~="bg-port-card/50"] {
+ background-color: rgb(var(--port-card) / var(--port-card-alpha)) !important;
+}
+
+html[data-port-theme] .border-port-border,
+html[data-port-theme] .divide-port-border > :not([hidden]) ~ :not([hidden]) {
+ border-color: rgb(var(--port-border) / var(--port-border-alpha)) !important;
+ border-style: var(--port-border-style);
+}
+
+html[data-port-theme] .rounded {
+ border-radius: var(--port-radius-md) !important;
+}
+
+html[data-port-theme] .rounded-lg {
+ border-radius: var(--port-radius-lg) !important;
+}
+
+html[data-port-theme] .rounded-xl,
+html[data-port-theme] .rounded-2xl {
+ border-radius: var(--port-radius-xl) !important;
+}
+
+html[data-port-theme] .rounded-full {
+ border-radius: var(--port-radius-pill) !important;
+}
+
+html[data-port-theme] input,
+html[data-port-theme] textarea,
+html[data-port-theme] select {
+ background: var(--port-input-bg) !important;
+ border-color: var(--port-control-border) !important;
+ color: rgb(var(--port-text));
+ transition:
+ border-color var(--port-motion-fast) ease,
+ box-shadow var(--port-motion-fast) ease,
+ background-color var(--port-motion-fast) ease;
+}
+
+html[data-port-theme] input::placeholder,
+html[data-port-theme] textarea::placeholder {
+ color: rgb(var(--port-text-muted) / 0.62);
+}
+
+html[data-port-theme] button,
+html[data-port-theme] a,
+html[data-port-theme] [role="button"] {
+ transition:
+ background-color var(--port-motion-fast) ease,
+ border-color var(--port-motion-fast) ease,
+ box-shadow var(--port-motion-fast) ease,
+ color var(--port-motion-fast) ease,
+ opacity var(--port-motion-fast) ease;
+}
+
+html[data-port-theme] :is(.bg-port-card, [class~="bg-port-card/50"]):is(.border, .rounded, .rounded-lg, .rounded-xl, .rounded-2xl) {
+ backdrop-filter: var(--port-backdrop-filter);
+ box-shadow: var(--port-shadow-card);
+}
+
+html[data-port-theme] :is(.shadow-lg, .shadow-xl, .shadow-2xl) {
+ box-shadow: var(--port-shadow-elevated) !important;
+}
+
+html[data-port-theme] #root > .bg-port-bg {
+ background: var(--port-app-backdrop) !important;
+}
+
+html[data-port-theme] aside.bg-port-card,
+html[data-port-theme] header.bg-port-card {
+ background: var(--port-sidebar-bg) !important;
+ backdrop-filter: var(--port-backdrop-filter);
+}
+
+html[data-port-theme] aside nav a,
+html[data-port-theme] aside nav button,
+html[data-port-theme] header a,
+html[data-port-theme] header button {
+ border-radius: var(--port-radius-lg) !important;
+}
+
+html[data-port-theme] aside nav :is(a, button):hover,
+html[data-port-theme] header :is(a, button):hover,
+html[data-port-theme] [class*="hover:bg-port-border"]:hover {
+ background: var(--port-hover-bg) !important;
+}
+
+html[data-port-theme] [class~="bg-port-accent/10"],
+html[data-port-theme] [class~="bg-port-accent/20"],
+html[data-port-theme] aside nav [aria-current="page"] {
+ background: var(--port-active-bg) !important;
+}
+
+html[data-port-theme] .bg-port-border,
+html[data-port-theme] [class~="bg-port-border/50"] {
+ background: var(--port-control-bg) !important;
+}
+
+html[data-port-theme] [class*="hover:bg-port-border"]:hover {
+ background: var(--port-control-bg-hover) !important;
+}
+
+html[data-port-theme] :is(.bg-port-border, [class~="bg-port-border/50"]):is([class~="text-gray-400"], [class~="text-gray-500"]) {
+ color: rgb(var(--port-control-text)) !important;
+}
+
+html[data-port-theme] .bg-port-accent {
+ box-shadow: var(--port-shadow-interactive);
+}
+
+html[data-port-theme] [class~="bg-port-accent"][class~="text-white"] {
+ color: rgb(var(--port-on-accent)) !important;
+}
+
+html[data-port-theme] [class~="bg-port-success"][class~="text-white"] {
+ color: rgb(var(--port-on-success)) !important;
+}
+
+html[data-port-theme] [class~="bg-port-warning"][class~="text-white"] {
+ color: rgb(var(--port-on-warning)) !important;
+}
+
+html[data-port-theme] [class~="bg-port-error"][class~="text-white"] {
+ color: rgb(var(--port-on-error)) !important;
+}
+
+html[data-port-theme] :is(.bg-port-error, .bg-port-warning, .bg-port-success, .bg-port-accent) {
+ border-radius: var(--port-radius-lg);
+}
+
+html[data-port-theme] .recharts-cartesian-grid line,
+html[data-port-theme] .recharts-polar-grid-angle line,
+html[data-port-theme] .recharts-polar-grid-concentric circle {
+ stroke: rgb(var(--port-chart-grid) / 0.34);
+}
+
+html[data-port-theme="lumen-glass"] main {
+ background:
+ linear-gradient(180deg, rgb(255 255 255 / 0.035), transparent 240px);
+}
+
+html[data-port-theme="lumen-glass"] :is(.bg-port-card, [class~="bg-port-card/50"]):is(.border, .rounded, .rounded-lg, .rounded-xl, .rounded-2xl) {
+ border-color: rgb(var(--port-border) / 0.28) !important;
+}
+
+html[data-port-theme="lumen-glass"] :is(input, textarea, select):focus,
+html[data-port-theme="lumen-glass"] button:focus-visible,
+html[data-port-theme="lumen-glass"] a:focus-visible {
+ box-shadow: 0 0 0 4px rgb(var(--port-focus-ring) / 0.18), 0 0 36px rgb(var(--port-focus-ring) / 0.12);
+}
+
+html[data-port-theme="black-ice-terminal"] body {
+ text-shadow: 0 0 12px rgb(var(--port-accent) / 0.08);
+}
+
+html[data-port-theme="black-ice-terminal"] body::after {
+ content: "";
+ position: fixed;
+ inset: 0;
+ z-index: 9998;
+ pointer-events: none;
+ background: repeating-linear-gradient(
+ 180deg,
+ rgb(255 255 255 / 0.025) 0,
+ rgb(255 255 255 / 0.025) 1px,
+ transparent 1px,
+ transparent 5px
+ );
+ mix-blend-mode: screen;
+ opacity: 0.22;
+}
+
+html[data-port-theme="black-ice-terminal"] :is(.bg-port-card, [class~="bg-port-card/50"]):is(.border, .rounded, .rounded-lg, .rounded-xl, .rounded-2xl) {
+ border-color: rgb(var(--port-border) / 0.34) !important;
+ background-image: linear-gradient(180deg, rgb(var(--port-accent) / 0.035), transparent 38px);
+}
+
+html[data-port-theme="black-ice-terminal"] :is(h1, h2, h3, h4, .text-lg, .text-xl, .text-2xl, .text-3xl) {
+ color: rgb(var(--port-text));
+}
+
+html[data-port-theme="black-ice-terminal"] :is(pre, code, textarea, input) {
+ text-shadow: 0 0 10px rgb(var(--port-accent) / 0.1);
+}
+
+html[data-port-theme="black-ice-terminal"] aside nav [aria-current="page"] {
+ border-left: 2px solid rgb(var(--port-accent));
+}
+
+html[data-port-theme="blueprint-ops"] body::before {
+ background-size: 20px 20px, 20px 20px, 100px 100px, 100px 100px;
+}
+
+html[data-port-theme="blueprint-ops"] :is(.bg-port-card, [class~="bg-port-card/50"]):is(.border, .rounded, .rounded-lg, .rounded-xl, .rounded-2xl) {
+ background-image:
+ linear-gradient(90deg, rgb(var(--port-border) / 0.045) 1px, transparent 1px),
+ linear-gradient(180deg, rgb(var(--port-border) / 0.035) 1px, transparent 1px);
+ background-size: 20px 20px;
+}
+
+html[data-port-theme="blueprint-ops"] :is(h1, h2, h3) {
+ border-left: 3px solid rgb(var(--port-accent) / 0.72);
+ padding-left: 0.55rem;
+}
+
+html[data-port-theme="blueprint-ops"] aside :is(h1, h2, h3),
+html[data-port-theme="blueprint-ops"] header :is(h1, h2, h3) {
+ border-left: 0;
+ padding-left: 0;
+}
+
/* Accessibility: Global focus styles for keyboard navigation */
*:focus-visible {
outline: 2px solid rgb(var(--port-focus-ring));
diff --git a/client/src/main.jsx b/client/src/main.jsx
index 43b3f2d0d6..ff86369dc1 100644
--- a/client/src/main.jsx
+++ b/client/src/main.jsx
@@ -30,7 +30,10 @@ ReactDOM.createRoot(document.getElementById('root')).render(
style: {
background: 'rgb(var(--port-card))',
color: 'rgb(var(--port-text))',
- border: '1px solid rgb(var(--port-border))'
+ border: '1px solid rgb(var(--port-border) / var(--port-border-alpha, 1))',
+ borderRadius: 'var(--port-radius-lg)',
+ backdropFilter: 'var(--port-backdrop-filter)',
+ boxShadow: 'var(--port-shadow-elevated)'
}
}}
/>
diff --git a/client/src/themes/familyIcons.js b/client/src/themes/familyIcons.js
new file mode 100644
index 0000000000..824d7d829c
--- /dev/null
+++ b/client/src/themes/familyIcons.js
@@ -0,0 +1,10 @@
+import { Compass, Palette, Sparkles, Terminal } from 'lucide-react';
+
+export const FAMILY_ICON = {
+ classic: Palette,
+ glass: Sparkles,
+ terminal: Terminal,
+ blueprint: Compass,
+};
+
+export const getFamilyIcon = (family) => FAMILY_ICON[family] ?? Palette;
diff --git a/client/src/themes/portosThemes.js b/client/src/themes/portosThemes.js
new file mode 100644
index 0000000000..86b12f2280
--- /dev/null
+++ b/client/src/themes/portosThemes.js
@@ -0,0 +1,320 @@
+export const DEFAULT_THEME_ID = 'classic-midnight';
+
+const baseStatusColors = {
+ '--port-success': '34 197 94',
+ '--port-warning': '245 158 11',
+ '--port-error': '239 68 68',
+ '--port-on-success': '255 255 255',
+ '--port-on-warning': '17 24 39',
+ '--port-on-error': '255 255 255',
+};
+
+const baseMotionTokens = {
+ '--port-motion-fast': '120ms',
+ '--port-motion-medium': '220ms',
+ '--port-motion-slow': '420ms',
+};
+
+const classicShapeTokens = {
+ '--port-radius-sm': '0.25rem',
+ '--port-radius-md': '0.375rem',
+ '--port-radius-lg': '0.5rem',
+ '--port-radius-xl': '0.75rem',
+ '--port-radius-pill': '9999px',
+};
+
+export const THEMES = {
+ [DEFAULT_THEME_ID]: {
+ id: DEFAULT_THEME_ID,
+ label: 'Classic Midnight',
+ shortLabel: 'Classic',
+ concept: 'The existing PortOS interface, kept as the stable baseline.',
+ family: 'classic',
+ accent: '#3b82f6',
+ doc: '/docs/themes/classic-midnight.md',
+ colorScheme: 'dark',
+ density: 'comfortable',
+ swatches: ['#0f0f0f', '#1a1a1a', '#3b82f6', '#22c55e'],
+ colors: {
+ '--port-bg': '15 15 15',
+ '--port-card': '26 26 26',
+ '--port-border': '42 42 42',
+ '--port-accent': '59 130 246',
+ '--port-text': '229 229 229',
+ '--port-text-muted': '163 163 163',
+ '--port-control-text': '212 212 216',
+ '--port-focus-ring': '59 130 246',
+ '--port-on-accent': '255 255 255',
+ ...baseStatusColors,
+ },
+ tokens: {
+ ...classicShapeTokens,
+ ...baseMotionTokens,
+ '--port-bg-alpha': '1',
+ '--port-card-alpha': '1',
+ '--port-border-alpha': '1',
+ '--port-sidebar-alpha': '1',
+ '--port-overlay-alpha': '0.72',
+ '--port-panel-padding-scale': '1',
+ '--port-font-ui': "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif",
+ '--port-font-display': "var(--port-font-ui)",
+ '--port-font-mono': "'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace",
+ '--port-shadow-card': 'none',
+ '--port-shadow-elevated': '0 18px 45px rgb(0 0 0 / 0.35)',
+ '--port-shadow-interactive': 'none',
+ '--port-backdrop-filter': 'none',
+ '--port-border-style': 'solid',
+ '--port-body-gradient': 'none',
+ '--port-body-texture': 'none',
+ '--port-body-overlay-opacity': '0',
+ '--port-app-backdrop': 'rgb(var(--port-bg))',
+ '--port-sidebar-bg': 'rgb(var(--port-card))',
+ '--port-input-bg': 'rgb(var(--port-bg))',
+ '--port-control-bg': 'rgb(var(--port-border))',
+ '--port-control-bg-hover': 'rgb(64 64 64)',
+ '--port-control-border': 'rgb(var(--port-border))',
+ '--port-active-bg': 'rgb(var(--port-accent) / 0.1)',
+ '--port-hover-bg': 'rgb(var(--port-border) / 0.5)',
+ '--port-terminal-bg': 'rgb(7 7 7)',
+ '--port-terminal-text': 'rgb(229 229 229)',
+ '--port-chart-1': '59 130 246',
+ '--port-chart-2': '34 197 94',
+ '--port-chart-3': '245 158 11',
+ '--port-chart-4': '236 72 153',
+ '--port-chart-grid': '64 64 64',
+ },
+ },
+
+ 'lumen-glass': {
+ id: 'lumen-glass',
+ label: 'Lumen Glass',
+ shortLabel: 'Glass',
+ concept: 'A translucent local-first command deck with layered glass panes and soft luminous depth.',
+ family: 'glass',
+ accent: '#67e8f9',
+ doc: '/docs/themes/lumen-glass.md',
+ colorScheme: 'dark',
+ density: 'spacious',
+ swatches: ['#071016', '#12242d', '#67e8f9', '#fb7185'],
+ colors: {
+ '--port-bg': '7 16 22',
+ '--port-card': '18 36 45',
+ '--port-border': '129 229 255',
+ '--port-accent': '103 232 249',
+ '--port-success': '74 222 128',
+ '--port-warning': '251 191 36',
+ '--port-error': '251 113 133',
+ '--port-on-accent': '4 35 44',
+ '--port-on-success': '6 43 24',
+ '--port-on-warning': '55 37 5',
+ '--port-on-error': '69 10 24',
+ '--port-text': '236 253 255',
+ '--port-text-muted': '160 190 202',
+ '--port-control-text': '220 247 252',
+ '--port-focus-ring': '103 232 249',
+ },
+ tokens: {
+ ...baseMotionTokens,
+ '--port-radius-sm': '0.5rem',
+ '--port-radius-md': '0.75rem',
+ '--port-radius-lg': '1rem',
+ '--port-radius-xl': '1.25rem',
+ '--port-radius-pill': '9999px',
+ '--port-bg-alpha': '0.92',
+ '--port-card-alpha': '0.58',
+ '--port-border-alpha': '0.24',
+ '--port-sidebar-alpha': '0.72',
+ '--port-overlay-alpha': '0.68',
+ '--port-panel-padding-scale': '1.08',
+ '--port-font-ui': "Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
+ '--port-font-display': "var(--port-font-ui)",
+ '--port-font-mono': "'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace",
+ '--port-shadow-card': '0 22px 55px rgb(0 0 0 / 0.28), inset 0 1px 0 rgb(255 255 255 / 0.08)',
+ '--port-shadow-elevated': '0 28px 80px rgb(0 0 0 / 0.42), inset 0 1px 0 rgb(255 255 255 / 0.12)',
+ '--port-shadow-interactive': '0 0 0 1px rgb(var(--port-accent) / 0.18), 0 0 28px rgb(var(--port-accent) / 0.12)',
+ '--port-backdrop-filter': 'blur(22px) saturate(1.35)',
+ '--port-border-style': 'solid',
+ '--port-body-gradient': 'linear-gradient(135deg, rgb(6 12 18) 0%, rgb(9 31 38) 45%, rgb(29 17 34) 100%)',
+ '--port-body-texture': 'linear-gradient(90deg, rgb(255 255 255 / 0.025) 1px, transparent 1px), linear-gradient(180deg, rgb(255 255 255 / 0.018) 1px, transparent 1px)',
+ '--port-body-overlay-opacity': '0.72',
+ '--port-app-backdrop': 'linear-gradient(135deg, rgb(var(--port-bg) / 0.82), rgb(9 28 36 / 0.84))',
+ '--port-sidebar-bg': 'linear-gradient(180deg, rgb(12 24 31 / 0.82), rgb(13 20 29 / 0.72))',
+ '--port-input-bg': 'rgb(8 18 24 / 0.72)',
+ '--port-control-bg': 'rgb(21 42 52 / 0.82)',
+ '--port-control-bg-hover': 'rgb(31 62 75 / 0.9)',
+ '--port-control-border': 'rgb(var(--port-border) / 0.3)',
+ '--port-active-bg': 'linear-gradient(135deg, rgb(var(--port-accent) / 0.18), rgb(251 113 133 / 0.12))',
+ '--port-hover-bg': 'rgb(255 255 255 / 0.08)',
+ '--port-terminal-bg': 'rgb(5 12 16 / 0.86)',
+ '--port-terminal-text': 'rgb(218 252 255)',
+ '--port-chart-1': '103 232 249',
+ '--port-chart-2': '74 222 128',
+ '--port-chart-3': '251 191 36',
+ '--port-chart-4': '251 113 133',
+ '--port-chart-grid': '129 229 255',
+ },
+ },
+
+ 'black-ice-terminal': {
+ id: 'black-ice-terminal',
+ label: 'Black ICE Terminal',
+ shortLabel: 'Terminal',
+ concept: 'A dense cyberpunk terminal interface for agents, logs, orchestration, and system control.',
+ family: 'terminal',
+ accent: '#00f5a0',
+ doc: '/docs/themes/black-ice-terminal.md',
+ colorScheme: 'dark',
+ density: 'compact',
+ swatches: ['#020403', '#07120d', '#00f5a0', '#ff2bd6'],
+ colors: {
+ '--port-bg': '2 4 3',
+ '--port-card': '6 13 10',
+ '--port-border': '0 245 160',
+ '--port-accent': '0 245 160',
+ '--port-success': '45 255 136',
+ '--port-warning': '255 214 10',
+ '--port-error': '255 47 117',
+ '--port-on-accent': '0 22 14',
+ '--port-on-success': '0 28 12',
+ '--port-on-warning': '26 20 0',
+ '--port-on-error': '255 255 255',
+ '--port-text': '218 255 238',
+ '--port-text-muted': '112 166 139',
+ '--port-control-text': '207 255 230',
+ '--port-focus-ring': '0 245 160',
+ },
+ tokens: {
+ '--port-motion-fast': '80ms',
+ '--port-motion-medium': '140ms',
+ '--port-motion-slow': '260ms',
+ '--port-radius-sm': '0',
+ '--port-radius-md': '0.125rem',
+ '--port-radius-lg': '0.1875rem',
+ '--port-radius-xl': '0.25rem',
+ '--port-radius-pill': '0.25rem',
+ '--port-bg-alpha': '1',
+ '--port-card-alpha': '0.9',
+ '--port-border-alpha': '0.42',
+ '--port-sidebar-alpha': '0.98',
+ '--port-overlay-alpha': '0.82',
+ '--port-panel-padding-scale': '0.9',
+ '--port-font-ui': "'GeistPixelSquare', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace",
+ '--port-font-display': "'GeistPixelGrid', 'SFMono-Regular', Consolas, monospace",
+ '--port-font-mono': "'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace",
+ '--port-shadow-card': '0 0 0 1px rgb(var(--port-border) / 0.18), 0 0 26px rgb(var(--port-accent) / 0.08)',
+ '--port-shadow-elevated': '0 0 0 1px rgb(var(--port-border) / 0.3), 0 0 48px rgb(var(--port-accent) / 0.16), 0 18px 60px rgb(0 0 0 / 0.62)',
+ '--port-shadow-interactive': '0 0 0 1px rgb(var(--port-accent) / 0.45), 0 0 20px rgb(var(--port-accent) / 0.22)',
+ '--port-backdrop-filter': 'none',
+ '--port-border-style': 'solid',
+ '--port-body-gradient': 'linear-gradient(180deg, rgb(0 0 0) 0%, rgb(2 8 6) 100%)',
+ '--port-body-texture': 'linear-gradient(0deg, rgb(0 245 160 / 0.035) 1px, transparent 1px), linear-gradient(90deg, rgb(255 43 214 / 0.025) 1px, transparent 1px)',
+ '--port-body-overlay-opacity': '0.9',
+ '--port-app-backdrop': 'rgb(var(--port-bg))',
+ '--port-sidebar-bg': 'rgb(1 8 5 / 0.98)',
+ '--port-input-bg': 'rgb(0 0 0 / 0.72)',
+ '--port-control-bg': 'rgb(4 24 16 / 0.96)',
+ '--port-control-bg-hover': 'rgb(7 42 28 / 0.98)',
+ '--port-control-border': 'rgb(var(--port-border) / 0.42)',
+ '--port-active-bg': 'linear-gradient(90deg, rgb(var(--port-accent) / 0.18), rgb(255 43 214 / 0.08))',
+ '--port-hover-bg': 'rgb(var(--port-accent) / 0.08)',
+ '--port-terminal-bg': 'rgb(0 0 0)',
+ '--port-terminal-text': 'rgb(0 245 160)',
+ '--port-chart-1': '0 245 160',
+ '--port-chart-2': '255 43 214',
+ '--port-chart-3': '255 214 10',
+ '--port-chart-4': '0 194 255',
+ '--port-chart-grid': '0 245 160',
+ },
+ },
+
+ 'blueprint-ops': {
+ id: 'blueprint-ops',
+ label: 'Blueprint Ops',
+ shortLabel: 'Blueprint',
+ concept: 'A systems-map aesthetic with drafting-grid structure, annotated panels, and calm operational contrast.',
+ family: 'blueprint',
+ accent: '#60a5fa',
+ doc: '/docs/themes/blueprint-ops.md',
+ colorScheme: 'dark',
+ density: 'compact',
+ swatches: ['#0b1020', '#111827', '#60a5fa', '#f59e0b'],
+ colors: {
+ '--port-bg': '11 16 32',
+ '--port-card': '17 24 39',
+ '--port-border': '148 163 184',
+ '--port-accent': '96 165 250',
+ '--port-success': '52 211 153',
+ '--port-warning': '245 158 11',
+ '--port-error': '248 113 113',
+ '--port-on-accent': '7 17 32',
+ '--port-on-success': '6 36 27',
+ '--port-on-warning': '38 24 3',
+ '--port-on-error': '52 8 8',
+ '--port-text': '239 246 255',
+ '--port-text-muted': '156 178 204',
+ '--port-control-text': '224 236 251',
+ '--port-focus-ring': '96 165 250',
+ },
+ tokens: {
+ ...baseMotionTokens,
+ '--port-radius-sm': '0.125rem',
+ '--port-radius-md': '0.25rem',
+ '--port-radius-lg': '0.375rem',
+ '--port-radius-xl': '0.5rem',
+ '--port-radius-pill': '0.375rem',
+ '--port-bg-alpha': '1',
+ '--port-card-alpha': '0.86',
+ '--port-border-alpha': '0.28',
+ '--port-sidebar-alpha': '0.94',
+ '--port-overlay-alpha': '0.78',
+ '--port-panel-padding-scale': '0.96',
+ '--port-font-ui': "'Avenir Next', Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
+ '--port-font-display': "var(--port-font-ui)",
+ '--port-font-mono': "'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace",
+ '--port-shadow-card': '0 0 0 1px rgb(var(--port-border) / 0.1), 0 12px 28px rgb(0 0 0 / 0.2)',
+ '--port-shadow-elevated': '0 0 0 1px rgb(var(--port-border) / 0.18), 0 22px 54px rgb(0 0 0 / 0.38)',
+ '--port-shadow-interactive': '0 0 0 1px rgb(var(--port-accent) / 0.35), 0 0 0 4px rgb(var(--port-accent) / 0.08)',
+ '--port-backdrop-filter': 'blur(6px)',
+ '--port-border-style': 'solid',
+ '--port-body-gradient': 'linear-gradient(180deg, rgb(9 14 28) 0%, rgb(13 22 38) 100%)',
+ '--port-body-texture': 'linear-gradient(rgb(148 163 184 / 0.055) 1px, transparent 1px), linear-gradient(90deg, rgb(148 163 184 / 0.045) 1px, transparent 1px), linear-gradient(rgb(96 165 250 / 0.08) 1px, transparent 1px), linear-gradient(90deg, rgb(96 165 250 / 0.065) 1px, transparent 1px)',
+ '--port-body-overlay-opacity': '0.82',
+ '--port-app-backdrop': 'rgb(var(--port-bg) / 0.94)',
+ '--port-sidebar-bg': 'linear-gradient(180deg, rgb(13 20 37 / 0.96), rgb(15 23 42 / 0.92))',
+ '--port-input-bg': 'rgb(8 13 26 / 0.82)',
+ '--port-control-bg': 'rgb(24 35 56 / 0.92)',
+ '--port-control-bg-hover': 'rgb(34 48 76 / 0.96)',
+ '--port-control-border': 'rgb(var(--port-border) / 0.34)',
+ '--port-active-bg': 'linear-gradient(90deg, rgb(var(--port-accent) / 0.16), rgb(var(--port-warning) / 0.08))',
+ '--port-hover-bg': 'rgb(var(--port-border) / 0.1)',
+ '--port-terminal-bg': 'rgb(8 13 26)',
+ '--port-terminal-text': 'rgb(191 219 254)',
+ '--port-chart-1': '96 165 250',
+ '--port-chart-2': '52 211 153',
+ '--port-chart-3': '245 158 11',
+ '--port-chart-4': '248 113 113',
+ '--port-chart-grid': '148 163 184',
+ },
+ },
+};
+
+export const THEME_IDS = Object.keys(THEMES);
+export const THEME_LIST = THEME_IDS.map(id => THEMES[id]);
+
+export const LEGACY_THEME_ALIASES = {
+ midnight: DEFAULT_THEME_ID,
+ phosphor: 'black-ice-terminal',
+ ember: 'blueprint-ops',
+ arctic: 'lumen-glass',
+ synthwave: 'black-ice-terminal',
+};
+
+export function normalizeThemeId(id) {
+ if (!id || typeof id !== 'string') return DEFAULT_THEME_ID;
+ if (THEMES[id]) return id;
+ return LEGACY_THEME_ALIASES[id] ?? DEFAULT_THEME_ID;
+}
+
+export function getTheme(id) {
+ return THEMES[normalizeThemeId(id)];
+}
diff --git a/client/vite.config.js b/client/vite.config.js
index a1e68ee05e..145a15ef5f 100644
--- a/client/vite.config.js
+++ b/client/vite.config.js
@@ -32,7 +32,17 @@ export default defineConfig(({ mode }) => {
changeOrigin: true,
secure: false
},
- '/data': {
+ '/data/images': {
+ target: API_TARGET,
+ changeOrigin: true,
+ secure: false
+ },
+ '/data/videos': {
+ target: API_TARGET,
+ changeOrigin: true,
+ secure: false
+ },
+ '/data/video-thumbnails': {
target: API_TARGET,
changeOrigin: true,
secure: false
diff --git a/docs/themes/README.md b/docs/themes/README.md
new file mode 100644
index 0000000000..240f5e5e07
--- /dev/null
+++ b/docs/themes/README.md
@@ -0,0 +1,53 @@
+# PortOS Theme System
+
+PortOS themes are design systems, not palette presets. A theme defines color, surface material, typography, radius, shadows, density, chart colors, motion, and route-level feel through a manifest in `client/src/themes/portosThemes.js`.
+
+The current production UI remains available as `classic-midnight`. The three re-imagined concepts are:
+
+- `lumen-glass` - translucent glass control room.
+- `black-ice-terminal` - dense cyberpunk terminal.
+- `blueprint-ops` - systems-map drafting interface.
+
+## Integration Contract
+
+New UI should use semantic PortOS tokens wherever possible:
+
+- Colors: `bg-port-bg`, `bg-port-card`, `border-port-border`, `text-port-accent`, `text-port-success`, `text-port-warning`, `text-port-error`.
+- Text: default body text inherits `rgb(var(--port-text))`; secondary text should use `text-gray-400` or `rgb(var(--port-text-muted))` when authoring CSS.
+- Surfaces: prefer `bg-port-card border border-port-border rounded-lg` for panels and `bg-port-bg border border-port-border rounded-lg` for inset controls.
+- Controls: inputs, textareas, and selects should use `bg-port-bg border border-port-border`; theme CSS supplies the material, radius, and focus behavior.
+- Buttons: use `bg-port-accent text-white` for filled primary actions, `bg-port-border text-gray-400 hover:text-white` for neutral actions, and `bg-port-*/20 text-port-*` for tonal status actions. The runtime maps those legacy utility pairs to theme-safe control fills and foreground colors.
+- Icons: use the existing lucide icon style and let `text-port-accent` carry theme identity.
+- Charts: use `rgb(var(--port-chart-1))` through `rgb(var(--port-chart-4))` for series and `rgb(var(--port-chart-grid) / 0.34)` for grid lines.
+- Terminal/log output: use `var(--port-terminal-bg)` and `var(--port-terminal-text)` when authoring custom CSS.
+
+Avoid hard-coded background colors for major containers. Hard-coded state colors are acceptable only when they are data colors and still pass contrast in all themes.
+
+## Theme Runtime
+
+`useTheme` applies the active theme to `<html>`:
+
+- `data-port-theme`
+- `data-port-theme-family`
+- `data-port-theme-density`
+- CSS variables from the theme manifest
+
+The global CSS layer in `client/src/index.css` maps those variables onto existing PortOS utility classes. That keeps older pages working while new components can move toward semantic component primitives over time.
+
+## New Feature Checklist
+
+Before merging UI work:
+
+1. Test the feature in `classic-midnight`, `lumen-glass`, `black-ice-terminal`, and `blueprint-ops`.
+2. Check desktop and mobile widths.
+3. Verify focus rings, active tabs, hover states, forms, modals, toasts, and empty states.
+4. Check tables, charts, terminal/log blocks, and scroll containers when present.
+5. Run `npm run theme:check`.
+6. Run `npm run build`.
+
+## Documents
+
+- [Classic Midnight](./classic-midnight.md)
+- [Lumen Glass](./lumen-glass.md)
+- [Black ICE Terminal](./black-ice-terminal.md)
+- [Blueprint Ops](./blueprint-ops.md)
diff --git a/docs/themes/black-ice-terminal.md b/docs/themes/black-ice-terminal.md
new file mode 100644
index 0000000000..866d43b4dd
--- /dev/null
+++ b/docs/themes/black-ice-terminal.md
@@ -0,0 +1,26 @@
+# Black ICE Terminal
+
+## Intent
+
+Black ICE Terminal is PortOS as an operator console: dense, fast, cyberpunk, and log-friendly. It should make agents, shell sessions, process monitors, and orchestration feel native without making the whole app hard to read.
+
+## Integration Rules
+
+- Prefer compact layouts and clear separators over airy marketing-style cards.
+- Do not rely on color alone for status. Pair neon color with labels, icons, or layout position.
+- Keep forms and controls keyboard-friendly. Focus must be obvious.
+- Use terminal tokens for log/code regions: `var(--port-terminal-bg)` and `var(--port-terminal-text)`.
+- Avoid large soft gradients inside content panels. The theme uses sharp borders, scanlines, and restrained glow.
+
+## Component Notes
+
+- Panels use harder corners and visible borders.
+- Active nav and tabs should have both accent color and a shape/border cue.
+- Neutral controls should use the control fill tokens, not the neon border color as a solid background.
+- Tables, logs, and event streams should feel especially strong in this theme.
+- Media-heavy pages should keep media neutral; do not tint generated images or previews.
+- Long prose pages should not be forced into all-caps or oversized terminal styling.
+
+## Validation
+
+Check dense pages first: Shell, Dev Tools, Processes, Chief of Staff, Agents, Runs, CyberCity, and logs. Confirm scanline overlay does not reduce readability or block interaction.
diff --git a/docs/themes/blueprint-ops.md b/docs/themes/blueprint-ops.md
new file mode 100644
index 0000000000..c97b11edc6
--- /dev/null
+++ b/docs/themes/blueprint-ops.md
@@ -0,0 +1,26 @@
+# Blueprint Ops
+
+## Intent
+
+Blueprint Ops presents PortOS as a systems map: organized, annotated, technical, and calm. It should feel like a drafting table for apps, goals, agents, and personal telemetry.
+
+## Integration Rules
+
+- Favor structured panels, thin separators, compact metadata rows, and clear hierarchy.
+- Use the grid background as context, not decoration. Avoid adding extra grid patterns inside custom components unless the theme token supplies them.
+- Prefer precise labels and concise controls.
+- Use accent blue for selection, emerald for success, amber for attention, and red only for destructive or failed states.
+- Keep charts and diagrams legible with theme chart tokens.
+
+## Component Notes
+
+- Page headings receive a left rule in this theme. Avoid wrapping headings in deeply nested cards.
+- Cards should remain low-shadow and border-led.
+- Neutral controls should stay slate-filled with light text; reserve filled blue for primary actions.
+- Status badges should keep both text and color.
+- Forms should be compact but not cramped.
+- Graph, goals, calendar, insights, and dashboard views are the best-fit surfaces.
+
+## Validation
+
+Check horizontal overflow on mobile because compact blueprint layouts can accumulate metadata. Verify page headings, tabs, and card titles do not collide with the left-rule treatment.
diff --git a/docs/themes/classic-midnight.md b/docs/themes/classic-midnight.md
new file mode 100644
index 0000000000..c560a40ea7
--- /dev/null
+++ b/docs/themes/classic-midnight.md
@@ -0,0 +1,25 @@
+# Classic Midnight
+
+## Intent
+
+Classic Midnight preserves the existing PortOS UI: dark utilitarian panels, blue accent actions, compact navigation, and familiar rounded cards. It is the compatibility baseline for every theme change.
+
+## Integration Rules
+
+- Use existing PortOS utility colors and component structure.
+- Keep rounded panels at the current radius scale unless the component has a product reason to differ.
+- Use blue for primary actions and focus states.
+- Use existing spacing density.
+- Avoid theme-specific conditionals. If a component works only in Classic Midnight, the component is too tightly styled.
+
+## Component Notes
+
+- Panels: `bg-port-card border border-port-border rounded-lg`.
+- Inset regions: `bg-port-bg border border-port-border rounded-lg`.
+- Primary buttons: `bg-port-accent text-white`.
+- Secondary buttons: `bg-port-card border border-port-border text-gray-300`.
+- Code blocks: `bg-port-bg border border-port-border font-mono`.
+
+## Validation
+
+Classic Midnight should look nearly identical to the pre-manifest interface. Any major difference here should be intentional and documented in the PR.
diff --git a/docs/themes/lumen-glass.md b/docs/themes/lumen-glass.md
new file mode 100644
index 0000000000..8245079f66
--- /dev/null
+++ b/docs/themes/lumen-glass.md
@@ -0,0 +1,26 @@
+# Lumen Glass
+
+## Intent
+
+Lumen Glass turns PortOS into a translucent personal command deck. It should feel layered, luminous, and calm while keeping the app practical for repeated daily use.
+
+## Integration Rules
+
+- Let surfaces breathe. Prefer fewer nested cards and use page sections or panels directly.
+- Use `bg-port-card border border-port-border` for glass panes. The theme supplies transparency, blur, border alpha, and depth.
+- Avoid opaque hard-coded dark panels unless the content is media, code, or terminal output.
+- Avoid extra decorative blobs or unrelated gradients. The theme background already carries the visual atmosphere.
+- Keep icon buttons compact and use `text-port-accent` for tool affordances.
+
+## Component Notes
+
+- Cards and modals should keep their borders visible so transparent surfaces remain legible.
+- Inputs should use standard PortOS input classes; the theme converts them to translucent controls.
+- Filled buttons use dark foreground tokens on bright cyan surfaces. Do not override them with muted gray text.
+- Tables should keep row separators because glass depth alone is not enough for dense data.
+- Charts should use the theme chart variables rather than fixed blue-only series.
+- Toasts and command palette overlays should use elevated shadows and backdrop blur.
+
+## Validation
+
+Check text contrast over every transparent surface. Pay special attention to data grids, empty states, and nested panels where background content can show through.
diff --git a/package.json b/package.json
index d2fb082ad6..f80de9333b 100644
--- a/package.json
+++ b/package.json
@@ -29,6 +29,7 @@
"setup:hooks": "bash scripts/setup-git-hooks.sh",
"update": "node -e \"const{spawnSync:s}=require('child_process');const w=process.platform==='win32';const r=s(w?'powershell':'bash',w?['-NoProfile','-ExecutionPolicy','Bypass','-File','update.ps1']:['update.sh'],{stdio:'inherit'});process.exit(r.status??1)\"",
"test": "npm test --prefix server",
+ "theme:check": "node scripts/check-themes.js",
"smoke": "node scripts/smoke-boot.js"
},
"devDependencies": {
diff --git a/scripts/check-themes.js b/scripts/check-themes.js
new file mode 100644
index 0000000000..6c3d186356
--- /dev/null
+++ b/scripts/check-themes.js
@@ -0,0 +1,138 @@
+import { strict as assert } from 'node:assert';
+import { access, readFile } from 'node:fs/promises';
+import { dirname, join } from 'node:path';
+import { fileURLToPath } from 'node:url';
+import {
+ DEFAULT_THEME_ID,
+ LEGACY_THEME_ALIASES,
+ THEME_IDS,
+ THEMES,
+ getTheme,
+ normalizeThemeId,
+} from '../client/src/themes/portosThemes.js';
+
+const __dirname = dirname(fileURLToPath(import.meta.url));
+const repoRoot = join(__dirname, '..');
+
+const REQUIRED_COLOR_VARS = [
+ '--port-bg',
+ '--port-card',
+ '--port-border',
+ '--port-accent',
+ '--port-success',
+ '--port-warning',
+ '--port-error',
+ '--port-on-accent',
+ '--port-on-success',
+ '--port-on-warning',
+ '--port-on-error',
+ '--port-text',
+ '--port-text-muted',
+ '--port-control-text',
+ '--port-focus-ring',
+];
+
+const REQUIRED_TOKEN_VARS = [
+ '--port-radius-sm',
+ '--port-radius-md',
+ '--port-radius-lg',
+ '--port-radius-xl',
+ '--port-radius-pill',
+ '--port-font-ui',
+ '--port-font-display',
+ '--port-font-mono',
+ '--port-shadow-card',
+ '--port-shadow-elevated',
+ '--port-shadow-interactive',
+ '--port-backdrop-filter',
+ '--port-body-gradient',
+ '--port-body-texture',
+ '--port-app-backdrop',
+ '--port-sidebar-bg',
+ '--port-input-bg',
+ '--port-control-bg',
+ '--port-control-bg-hover',
+ '--port-control-border',
+ '--port-active-bg',
+ '--port-hover-bg',
+ '--port-terminal-bg',
+ '--port-terminal-text',
+ '--port-chart-1',
+ '--port-chart-2',
+ '--port-chart-3',
+ '--port-chart-4',
+ '--port-chart-grid',
+];
+
+const REQUIRED_DOC_SECTIONS = [
+ '## Intent',
+ '## Integration Rules',
+ '## Component Notes',
+ '## Validation',
+];
+
+function assertRgbChannels(value, themeId, varName) {
+ assert(typeof value === 'string', `${themeId} ${varName} must be a string`);
+ assert(/^\d{1,3} \d{1,3} \d{1,3}$/.test(value), `${themeId} ${varName} must be RGB channels`);
+ for (const channel of value.split(' ').map(Number)) {
+ assert(channel >= 0 && channel <= 255, `${themeId} ${varName} has out-of-range channel ${channel}`);
+ }
+}
+
+async function checkThemeDocs(theme) {
+ assert(theme.doc?.startsWith('/docs/themes/'), `${theme.id} doc must live under docs/themes`);
+ const docPath = join(repoRoot, theme.doc.slice(1));
+ await access(docPath);
+ const contents = await readFile(docPath, 'utf8');
+ for (const section of REQUIRED_DOC_SECTIONS) {
+ assert(contents.includes(section), `${theme.id} doc is missing ${section}`);
+ }
+}
+
+async function main() {
+ assert(THEME_IDS.includes(DEFAULT_THEME_ID), 'DEFAULT_THEME_ID is not registered');
+ assert(THEME_IDS.length >= 4, 'Expected classic plus at least three concept themes');
+
+ const labels = new Set();
+ for (const id of THEME_IDS) {
+ const theme = THEMES[id];
+ assert(theme.id === id, `${id} manifest id mismatch`);
+ assert(!labels.has(theme.label), `${id} label is duplicated`);
+ labels.add(theme.label);
+ assert(theme.concept?.length > 20, `${id} needs a concept statement`);
+ assert(theme.family, `${id} needs a family`);
+ assert(theme.density, `${id} needs a density`);
+ assert(theme.accent?.startsWith('#'), `${id} needs a hex accent`);
+ assert(Array.isArray(theme.swatches) && theme.swatches.length >= 4, `${id} needs at least four swatches`);
+
+ for (const varName of REQUIRED_COLOR_VARS) {
+ assertRgbChannels(theme.colors[varName], id, varName);
+ }
+ for (const varName of REQUIRED_TOKEN_VARS) {
+ assert(theme.tokens[varName], `${id} is missing token ${varName}`);
+ }
+ await checkThemeDocs(theme);
+ }
+
+ for (const [legacyId, nextId] of Object.entries(LEGACY_THEME_ALIASES)) {
+ assert(THEMES[nextId], `Legacy alias ${legacyId} points to unknown theme ${nextId}`);
+ assert(normalizeThemeId(legacyId) === nextId, `Legacy alias ${legacyId} did not normalize`);
+ assert(getTheme(legacyId).id === nextId, `getTheme(${legacyId}) did not return alias target`);
+ }
+
+ const css = await readFile(join(repoRoot, 'client/src/index.css'), 'utf8');
+ for (const id of THEME_IDS) {
+ assert(
+ id === DEFAULT_THEME_ID || css.includes(`data-port-theme="${id}"`),
+ `index.css is missing a theme-specific selector for ${id}`,
+ );
+ }
+ assert(css.includes('data-port-theme'), 'index.css must include the theme runtime layer');
+
+ console.log(`Theme contract OK: ${THEME_IDS.join(', ')}`);
+}
+
+main().catch(err => {
+ console.error(err.message);
+ process.exit(1);
+});