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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
add Kestrel Neon theme family and a shared, token-driven effects layer
[._.]/ Adam Eivyc2ad28441504
diff --git a/client/src/hooks/useTheme.js b/client/src/hooks/useTheme.jsindex 2750d6df24..b329f24cdf 100644--- a/client/src/hooks/useTheme.js+++ b/client/src/hooks/useTheme.js@@ -11,18 +11,33 @@ import { getSettings, updateSettings } from '../services/apiSystem.js';const STORAGE_KEY = 'portos-theme';+// Custom properties the last applyTheme() wrote. A theme only declares the+// tokens it uses (the optional --port-fx-* effect tokens especially), and an+// inline property on <html> outlives a theme switch — so without clearing+// these, Kestrel Neon's multiply-blend scanlines would still tint Classic+// Midnight after the user switched away.+let appliedVars = new Set();+const applyTheme = (id) => {const theme = getTheme(id);const style = document.documentElement.style;const vars = { ...theme.colors, ...theme.tokens };+ for (const prop of appliedVars) {+ if (!(prop in vars)) style.removeProperty(prop);+ }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.dataset.portThemeMode = theme.mode;- document.documentElement.style.colorScheme = theme.colorScheme ?? 'dark';+ appliedVars = new Set(Object.keys(vars));+ const root = document.documentElement;+ root.dataset.portTheme = theme.id;+ root.dataset.portThemeFamily = theme.family;+ root.dataset.portThemeDensity = theme.density;+ root.dataset.portThemeMode = theme.mode;+ // Space-separated so index.css can key on html[data-port-theme-effects~="x"].+ if (theme.effects?.length) root.dataset.portThemeEffects = theme.effects.join(' ');+ else delete root.dataset.portThemeEffects;+ root.style.colorScheme = theme.colorScheme ?? 'dark';return theme.id;};diff --git a/client/src/hooks/useTheme.test.jsx b/client/src/hooks/useTheme.test.jsxindex bd9342dc32..3707396bd3 100644--- a/client/src/hooks/useTheme.test.jsx+++ b/client/src/hooks/useTheme.test.jsx@@ -1,7 +1,7 @@import { describe, it, expect, afterEach, beforeEach, vi } from 'vitest';import { renderHook, act, waitFor } from '@testing-library/react';import useTheme from './useTheme.js';-import { DEFAULT_THEME_ID, THEME_IDS } from '../themes/portosThemes.js';+import { DEFAULT_THEME_ID, THEME_IDS, THEMES } from '../themes/portosThemes.js';// Pick any non-default valid theme to prove in-memory switching still works.const OTHER_THEME_ID = THEME_IDS.find((id) => id !== DEFAULT_THEME_ID);@@ -15,10 +15,39 @@ afterEach(() => {vi.restoreAllMocks();document.documentElement.removeAttribute('style');document.documentElement.removeAttribute('data-port-theme');+ document.documentElement.removeAttribute('data-port-theme-effects');window.localStorage.clear();window.history.replaceState({}, '', '/');});+describe('useTheme applies the manifest to <html>', () => {+ const withEffects = Object.values(THEMES).find((t) => t.effects?.length);+ const withoutEffects = Object.values(THEMES).find((t) => !t.effects?.length);+ // A token only the effects theme declares — it must not survive the switch.+ const privateToken = Object.keys(withEffects.tokens).find((k) => !(k in withoutEffects.tokens));++ it('publishes the effects list and clears it again for a theme with none', () => {+ const { result } = renderHook(() => useTheme());+ act(() => result.current.setTheme(withEffects.id));+ expect(document.documentElement.dataset.portThemeEffects).toBe(withEffects.effects.join(' '));++ act(() => result.current.setTheme(withoutEffects.id));+ expect(document.documentElement.dataset.portThemeEffects).toBeUndefined();+ });++ it('removes custom properties the next theme does not declare', () => {+ expect(privateToken).toBeTruthy();+ const { result } = renderHook(() => useTheme());+ act(() => result.current.setTheme(withEffects.id));+ expect(document.documentElement.style.getPropertyValue(privateToken)).not.toBe('');++ act(() => result.current.setTheme(withoutEffects.id));+ expect(document.documentElement.style.getPropertyValue(privateToken)).toBe('');+ expect(document.documentElement.style.getPropertyValue('--port-accent'))+ .toBe(withoutEffects.colors['--port-accent']);+ });+});+describe('useTheme localStorage resilience', () => {it('initializes to the default theme when reads throw (blocked storage)', () => {vi.spyOn(window.localStorage, 'getItem').mockImplementation(() => {diff --git a/client/src/index.css b/client/src/index.cssindex 162af71e24..4a482dd66e 100644--- a/client/src/index.css+++ b/client/src/index.css@@ -1025,23 +1025,6 @@ 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);@@ -1441,23 +1424,6 @@ html[data-port-theme="black-ice-terminal-day"] body {text-shadow: 0 0 8px rgb(var(--port-accent) / 0.04);}-html[data-port-theme="black-ice-terminal-day"] body::after {- content: "";- position: fixed;- inset: 0;- z-index: 9998;- pointer-events: none;- background: repeating-linear-gradient(- 180deg,- rgb(10 60 30 / 0.04) 0,- rgb(10 60 30 / 0.04) 1px,- transparent 1px,- transparent 5px- );- mix-blend-mode: multiply;- opacity: 0.4;-}-html[data-port-theme="black-ice-terminal-day"] :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.32) !important;background-image: linear-gradient(180deg, rgb(255 255 255 / 0.5), transparent 38px);@@ -1490,6 +1456,183 @@ html[data-port-theme="blueprint-ops-day"] header :is(h1, h2, h3) {padding-left: 0;}+/* === Theme effects layer ===+ A theme opts into full-screen effects by listing them in `effects` in+ portosThemes.js; useTheme publishes that list as+ html[data-port-theme-effects="scanlines vignette …"], so each block below+ keys on the ~= attribute selector. Colors, strengths, and timings come from+ --port-fx-* tokens the theme declares (defaults here), so a new theme+ composes effects without adding selectors of its own.++ The overlay effects (scanlines, vignette, sweep) share ONE body::after so+ they compose in a single background list; an effect the theme did not list+ resolves to a transparent layer. */+:root {+ --port-fx-scanline-color: rgb(255 255 255 / 0.025);+ --port-fx-scanline-period: 5px;+ --port-fx-scanline-thickness: 1px;+ --port-fx-overlay-blend: screen;+ --port-fx-overlay-opacity: 0.22;+ --port-fx-vignette-color: rgb(0 0 0 / 0.55);+ --port-fx-sweep-color: rgb(var(--port-accent) / 0.07);+ --port-fx-sweep-duration: 7s;+ --port-fx-grid-floor-x: rgb(var(--port-accent-2) / 0.18);+ --port-fx-grid-floor-y: rgb(var(--port-accent) / 0.18);+ --port-fx-grid-floor-opacity: 0.45;+ --port-fx-grid-floor-duration: 3s;+ --port-fx-glitch-period: 9s;+ /* Resolved per listed effect below; unlisted effects stay transparent. */+ --port-fx-scanline-active: transparent;+ --port-fx-vignette-active: transparent;+ --port-fx-sweep-active: transparent;+}++html[data-port-theme-effects~="scanlines"] { --port-fx-scanline-active: var(--port-fx-scanline-color); }+html[data-port-theme-effects~="vignette"] { --port-fx-vignette-active: var(--port-fx-vignette-color); }+html[data-port-theme-effects~="sweep"] { --port-fx-sweep-active: var(--port-fx-sweep-color); }++html:is([data-port-theme-effects~="scanlines"], [data-port-theme-effects~="vignette"], [data-port-theme-effects~="sweep"]) body::after {+ content: "";+ position: fixed;+ inset: 0;+ z-index: 9998;+ pointer-events: none;+ background:+ linear-gradient(180deg, transparent, var(--port-fx-sweep-active), transparent) 0 -20% / 100% 18% no-repeat,+ radial-gradient(ellipse at center, transparent 58%, var(--port-fx-vignette-active) 100%),+ repeating-linear-gradient(+ 0deg,+ transparent 0 calc(var(--port-fx-scanline-period) - var(--port-fx-scanline-thickness)),+ var(--port-fx-scanline-active) calc(var(--port-fx-scanline-period) - var(--port-fx-scanline-thickness)) var(--port-fx-scanline-period)+ );+ mix-blend-mode: var(--port-fx-overlay-blend);+ opacity: var(--port-fx-overlay-opacity);+}++html[data-port-theme-effects~="sweep"] body::after {+ animation: portos-fx-sweep var(--port-fx-sweep-duration) linear infinite;+}++@keyframes portos-fx-sweep {+ to { background-position: 0 120%, 0 0, 0 0; }+}++/* Perspective grid floor: fixed behind content, masked so it fades toward the+ horizon. Lives on #root::before because body::before is the shared+ token-driven backdrop and a background-image cannot be tilted. */+html[data-port-theme-effects~="grid-floor"] #root::before {+ content: "";+ position: fixed;+ /* Three viewports wide and one tall, hinged at its bottom edge and tilted+ away: the near rows stay full size while the far rows converge toward a+ horizon about a quarter of the way up the screen. The extra width keeps+ the foreshortened far edge wider than the viewport. */+ left: -100%;+ right: -100%;+ bottom: -6%;+ height: 100%;+ z-index: -1;+ pointer-events: none;+ background:+ linear-gradient(90deg, var(--port-fx-grid-floor-x) 1px, transparent 1px) 0 0 / 60px 100%,+ linear-gradient(0deg, var(--port-fx-grid-floor-y) 1px, transparent 1px) 0 0 / 100% 40px;+ transform: perspective(1200px) rotateX(60deg);+ transform-origin: 50% 100%;+ mask-image: linear-gradient(180deg, transparent 30%, #000 75%);+ -webkit-mask-image: linear-gradient(180deg, transparent 30%, #000 75%);+ opacity: var(--port-fx-grid-floor-opacity);+ animation: portos-fx-gridmove var(--port-fx-grid-floor-duration) linear infinite;+}++@keyframes portos-fx-gridmove {+ to { background-position: 0 0, 0 40px; }+}++/* Page titles glitch every few seconds: at rest for most of the cycle, then a+ two-step chromatic split between the two accents. */+html[data-port-theme-effects~="glitch"] h1 {+ animation: portos-fx-glitch var(--port-fx-glitch-period) steps(2) infinite;+}++@keyframes portos-fx-glitch {+ 0%, 92%, 100% { text-shadow: 0 0 12px rgb(var(--port-accent) / 0.5); transform: none; }+ 94% { text-shadow: -3px 0 rgb(var(--port-accent-2)), 3px 0 rgb(var(--port-accent)); transform: translate(-1px, 1px); }+ 96% { text-shadow: 4px 0 rgb(var(--port-accent-2)), -4px 0 rgb(var(--port-accent)); transform: translate(2px, -1px); }+ 98% { text-shadow: -1px 0 rgb(var(--port-accent-2)), 1px 0 rgb(var(--port-accent)); transform: translate(1px, 0); }+}++@media (prefers-reduced-motion: reduce) {+ html[data-port-theme-effects] body::after,+ html[data-port-theme-effects] #root::before,+ html[data-port-theme-effects] h1 {+ animation: none;+ }+}++/* === Kestrel Neon (CRT boot terminal) === */+html[data-port-theme="kestrel-neon"] body {+ text-shadow: 0 0 10px rgb(var(--port-accent) / 0.08);+}++html[data-port-theme="kestrel-neon"] :is(h1, h2, h3) {+ letter-spacing: 0.06em;+ text-shadow: 0 0 12px rgb(var(--port-accent) / 0.5);+}++html[data-port-theme="kestrel-neon"] h1 {+ text-transform: uppercase;+ letter-spacing: 0.14em;+}++html[data-port-theme="kestrel-neon"] :is(.bg-port-card, [class~="bg-port-card/50"]):is(.border, .rounded, .rounded-lg, .rounded-xl, .rounded-2xl) {+ border-color: rgb(var(--port-accent-2) / 0.3) !important;+ background-image: linear-gradient(180deg, rgb(var(--port-accent) / 0.06), transparent 32px);+}++html[data-port-theme="kestrel-neon"] :is(pre, code, textarea, input) {+ text-shadow: 0 0 8px rgb(var(--port-accent) / 0.25);+ caret-color: rgb(var(--port-accent));+}++html[data-port-theme="kestrel-neon"] :is(input, textarea, select):focus,+html[data-port-theme="kestrel-neon"] button:focus-visible,+html[data-port-theme="kestrel-neon"] a:focus-visible {+ box-shadow: 0 0 0 1px rgb(var(--port-focus-ring) / 0.7), 0 0 18px rgb(var(--port-focus-ring) / 0.35);+}++html[data-port-theme="kestrel-neon"] aside nav [aria-current="page"] {+ border-left: 2px solid rgb(var(--port-accent-2));+ text-shadow: 0 0 8px rgb(var(--port-accent) / 0.6);+}++html[data-port-theme="kestrel-neon"] ::selection {+ background: rgb(var(--port-accent-2) / 0.45);+ color: rgb(255 255 255);+}++/* === Kestrel Dawn (Kestrel Neon, day) === */+html[data-port-theme="kestrel-neon-day"] :is(h1, h2, h3) {+ letter-spacing: 0.06em;+}++html[data-port-theme="kestrel-neon-day"] h1 {+ text-transform: uppercase;+ letter-spacing: 0.14em;+}++html[data-port-theme="kestrel-neon-day"] :is(.bg-port-card, [class~="bg-port-card/50"]):is(.border, .rounded, .rounded-lg, .rounded-xl, .rounded-2xl) {+ border-color: rgb(var(--port-accent-2) / 0.26) !important;+ background-image: linear-gradient(180deg, rgb(var(--port-accent) / 0.06), transparent 32px);+}++html[data-port-theme="kestrel-neon-day"] :is(pre, code, textarea, input) {+ caret-color: rgb(var(--port-accent));+}++html[data-port-theme="kestrel-neon-day"] aside nav [aria-current="page"] {+ border-left: 2px solid rgb(var(--port-accent-2));+}+/* Accessibility: Global focus styles for keyboard navigation */*:focus-visible {outline: 2px solid rgb(var(--port-focus-ring));diff --git a/client/src/themes/familyIcons.js b/client/src/themes/familyIcons.jsindex 824d7d829c..28cfc427fd 100644--- a/client/src/themes/familyIcons.js+++ b/client/src/themes/familyIcons.js@@ -1,10 +1,11 @@-import { Compass, Palette, Sparkles, Terminal } from 'lucide-react';+import { Compass, Hexagon, Palette, Sparkles, Terminal } from 'lucide-react';export const FAMILY_ICON = {classic: Palette,glass: Sparkles,terminal: Terminal,blueprint: Compass,+ kestrel: Hexagon,};export const getFamilyIcon = (family) => FAMILY_ICON[family] ?? Palette;diff --git a/client/src/themes/portosThemes.js b/client/src/themes/portosThemes.jsindex 9492438bc4..233c743a08 100644--- a/client/src/themes/portosThemes.js+++ b/client/src/themes/portosThemes.js@@ -28,6 +28,18 @@ const DEFAULT_ACCENT2 = {'--port-accent-2-text': '216 180 254',};+// Optional full-screen effects a theme composes by listing them in `effects`.+// Each is a shared CSS block in index.css keyed on+// html[data-port-theme-effects~="<name>"] and parameterized by --port-fx-*+// tokens (defaults in index.css :root), so a new theme picks effects and tunes+// their colors without adding selectors of its own.+// scanlines — CRT line overlay above the app (body::after)+// vignette — darkened viewport edges on that same overlay+// sweep — a phosphor band drifting down the overlay+// grid-floor — a perspective grid receding under the page (#root::before)+// glitch — periodic chromatic split on page titles (h1)+export const THEME_EFFECTS = Object.freeze(['scanlines', 'vignette', 'sweep', 'grid-floor', 'glitch']);+const baseMotionTokens = {'--port-motion-fast': '120ms','--port-motion-medium': '220ms',@@ -371,6 +383,7 @@ export const THEMES = {doc: '/docs/themes/black-ice-terminal.md',colorScheme: 'dark',density: 'compact',+ effects: ['scanlines'],swatches: ['#020403', '#151c19', '#00f5a0', '#ff2bd6'],colors: {'--port-bg': '2 4 3',@@ -442,6 +455,10 @@ export const THEMES = {'--port-chart-3': '255 214 10','--port-chart-4': '0 194 255','--port-chart-grid': '0 245 160',+ '--port-fx-scanline-color': 'rgb(255 255 255 / 0.025)',+ '--port-fx-scanline-period': '5px',+ '--port-fx-overlay-blend': 'screen',+ '--port-fx-overlay-opacity': '0.22',},},@@ -456,6 +473,7 @@ export const THEMES = {doc: '/docs/themes/black-ice-terminal.md',colorScheme: 'light',density: 'compact',+ effects: ['scanlines'],swatches: ['#ece6d5', '#fbf6e8', '#086c43', '#b91d6a'],colors: {'--port-bg': '236 230 213',@@ -526,6 +544,10 @@ export const THEMES = {'--port-chart-3': '170 110 0','--port-chart-4': '8 100 134','--port-chart-grid': '8 108 67',+ '--port-fx-scanline-color': 'rgb(10 60 30 / 0.04)',+ '--port-fx-scanline-period': '5px',+ '--port-fx-overlay-blend': 'multiply',+ '--port-fx-overlay-opacity': '0.4',},},@@ -692,6 +714,196 @@ export const THEMES = {'--port-chart-grid': '148 163 184',},},+ 'kestrel-neon': {+ id: 'kestrel-neon',+ label: 'Kestrel Neon',+ shortLabel: 'Kestrel',+ concept: 'A CRT boot terminal at midnight — cyan wireframes and magenta panel labels over a scanlined void with a perspective grid floor.',+ family: 'kestrel',+ mode: 'night',+ accent: '#00f0ff',+ doc: '/docs/themes/kestrel-neon.md',+ colorScheme: 'dark',+ density: 'compact',+ effects: ['scanlines', 'vignette', 'sweep', 'grid-floor', 'glitch'],+ swatches: ['#05060a', '#161a32', '#00f0ff', '#ff2bd6'],+ colors: {+ '--port-bg': '5 6 10',+ '--port-card': '22 26 50',+ '--port-border': '0 240 255',+ '--port-accent': '0 240 255',+ '--port-success': '92 255 138',+ '--port-success-text': '110 240 150',+ '--port-warning': '255 184 48',+ '--port-warning-text': '255 196 90',+ '--port-error': '255 77 109',+ '--port-error-text': '255 128 150',+ '--port-on-accent': '3 24 30',+ '--port-on-success': '0 40 14',+ '--port-on-warning': '40 24 0',+ '--port-on-error': '50 0 12',+ // Hot magenta — the reference terminal's second neon. Distinct from the+ // cyan accent and the rose error.+ '--port-accent-2': '255 43 214',+ '--port-on-accent-2': '48 0 40',+ '--port-accent-2-text': '255 120 226',+ '--port-text': '208 220 244',+ '--port-text-muted': '150 162 196',+ '--port-text-subtle': '126 138 172',+ '--port-accent-text': '0 224 240',+ '--port-control-text': '220 236 255',+ '--port-focus-ring': '0 240 255',+ },+ tokens: {+ '--port-motion-fast': '90ms',+ '--port-motion-medium': '160ms',+ '--port-motion-slow': '300ms',+ '--port-radius-sm': '0',+ '--port-radius-md': '0.125rem',+ '--port-radius-lg': '0.25rem',+ '--port-radius-xl': '0.375rem',+ '--port-radius-pill': '0.25rem',+ '--port-bg-alpha': '1',+ '--port-card-alpha': '0.92',+ '--port-card-min-alpha': '0.88',+ '--port-border-alpha': '0.3',+ '--port-sidebar-alpha': '0.96',+ '--port-overlay-alpha': '0.8',+ '--port-panel-padding-scale': '0.92',+ '--port-font-ui': "'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, 'Liberation Mono', monospace",+ '--port-font-display': "'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace",+ '--port-font-mono': "'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, 'Liberation Mono', monospace",+ '--port-shadow-card': '0 0 0 1px rgb(var(--port-accent-2) / 0.14), 0 0 34px rgb(var(--port-accent-2) / 0.08), inset 0 0 48px rgb(0 0 0 / 0.45)',+ '--port-shadow-elevated': '0 0 0 1px rgb(var(--port-accent) / 0.28), 0 0 44px rgb(var(--port-accent) / 0.14), 0 18px 60px rgb(0 0 0 / 0.7)',+ '--port-shadow-interactive': '0 0 0 1px rgb(var(--port-accent) / 0.45), 0 0 18px rgb(var(--port-accent) / 0.22)',+ '--port-backdrop-filter': 'blur(6px)',+ '--port-border-style': 'solid',+ '--port-body-gradient': 'radial-gradient(ellipse at 50% 0%, rgb(16 20 42) 0%, rgb(5 6 10) 60%)',+ '--port-body-texture': 'radial-gradient(ellipse at 50% 100%, rgb(var(--port-accent-2) / 0.08) 0%, transparent 55%)',+ '--port-body-size': 'cover, cover',+ '--port-body-overlay-opacity': '1',+ '--port-app-backdrop': 'transparent',+ '--port-sidebar-bg': 'rgb(10 12 22 / 0.94)',+ '--port-input-bg': 'rgb(3 4 8 / 0.8)',+ '--port-control-bg': 'rgb(14 18 36 / 0.94)',+ '--port-control-bg-hover': 'rgb(22 30 56 / 0.98)',+ '--port-control-border': 'rgb(var(--port-border) / 0.3)',+ '--port-active-bg': 'linear-gradient(90deg, rgb(var(--port-accent) / 0.16), rgb(var(--port-accent-2) / 0.1))',+ '--port-hover-bg': 'rgb(var(--port-accent) / 0.08)',+ '--port-terminal-bg': 'rgb(3 4 8)',+ '--port-terminal-text': 'rgb(208 220 244)',+ '--port-chart-1': '0 240 255',+ '--port-chart-2': '255 43 214',+ '--port-chart-3': '255 184 48',+ '--port-chart-4': '92 255 138',+ '--port-chart-grid': '0 240 255',+ '--port-fx-scanline-color': 'rgb(0 0 0 / 0.18)',+ '--port-fx-scanline-period': '3px',+ '--port-fx-overlay-blend': 'multiply',+ '--port-fx-overlay-opacity': '0.8',+ '--port-fx-vignette-color': 'rgb(0 0 0 / 0.55)',+ '--port-fx-sweep-color': 'rgb(var(--port-accent) / 0.07)',+ '--port-fx-sweep-duration': '7s',+ '--port-fx-grid-floor-x': 'rgb(var(--port-accent-2) / 0.32)',+ '--port-fx-grid-floor-y': 'rgb(var(--port-accent) / 0.32)',+ '--port-fx-grid-floor-opacity': '0.7',+ '--port-fx-grid-floor-duration': '3s',+ '--port-fx-glitch-period': '9s',+ },+ },++ 'kestrel-neon-day': {+ id: 'kestrel-neon-day',+ label: 'Kestrel Dawn',+ shortLabel: 'Kestrel',+ concept: 'Kestrel Neon at first light — holographic white panels, teal and magenta ink, the CRT grid faded to a watermark.',+ family: 'kestrel',+ mode: 'day',+ accent: '#0e7c8c',+ doc: '/docs/themes/kestrel-neon.md',+ colorScheme: 'light',+ density: 'compact',+ effects: ['scanlines', 'grid-floor'],+ swatches: ['#eaecf6', '#ffffff', '#0e7c8c', '#b5178f'],+ colors: {+ '--port-bg': '234 236 246',+ '--port-card': '255 255 255',+ '--port-border': '14 124 140',+ '--port-accent': '14 124 140',+ '--port-success': '21 128 61',+ '--port-success-text': '19 88 45',+ '--port-warning': '161 98 7',+ '--port-warning-text': '120 69 13',+ '--port-error': '190 18 60',+ '--port-error-text': '136 10 42',+ '--port-on-accent': '255 255 255',+ '--port-on-success': '255 255 255',+ '--port-on-warning': '255 255 255',+ '--port-on-error': '255 255 255',+ // Magenta ink — the night theme's second neon, darkened for AA on white.+ '--port-accent-2': '181 23 143',+ '--port-on-accent-2': '255 255 255',+ '--port-accent-2-text': '134 12 106',+ '--port-text': '32 38 66',+ '--port-text-muted': '76 84 118',+ '--port-text-subtle': '88 96 130',+ '--port-accent-text': '6 78 90',+ '--port-control-text': '32 38 66',+ '--port-focus-ring': '14 124 140',+ },+ tokens: {+ '--port-motion-fast': '90ms',+ '--port-motion-medium': '160ms',+ '--port-motion-slow': '300ms',+ '--port-radius-sm': '0',+ '--port-radius-md': '0.125rem',+ '--port-radius-lg': '0.25rem',+ '--port-radius-xl': '0.375rem',+ '--port-radius-pill': '0.25rem',+ '--port-bg-alpha': '1',+ '--port-card-alpha': '1',+ '--port-card-min-alpha': '1',+ '--port-border-alpha': '0.3',+ '--port-sidebar-alpha': '0.96',+ '--port-overlay-alpha': '0.66',+ '--port-panel-padding-scale': '0.92',+ '--port-font-ui': "'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, 'Liberation Mono', monospace",+ '--port-font-display': "'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace",+ '--port-font-mono': "'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, 'Liberation Mono', monospace",+ '--port-shadow-card': '0 0 0 1px rgb(var(--port-accent-2) / 0.12), 0 8px 24px -10px rgb(14 124 140 / 0.18)',+ '--port-shadow-elevated': '0 0 0 1px rgb(var(--port-accent) / 0.24), 0 22px 54px -16px rgb(14 124 140 / 0.28)',+ '--port-shadow-interactive': '0 0 0 1px rgb(var(--port-accent) / 0.5), 0 0 14px rgb(var(--port-accent) / 0.14)',+ '--port-backdrop-filter': 'none',+ '--port-border-style': 'solid',+ '--port-body-gradient': 'radial-gradient(ellipse at 50% 0%, rgb(255 255 255) 0%, rgb(234 236 246) 60%)',+ '--port-body-texture': 'radial-gradient(ellipse at 50% 100%, rgb(var(--port-accent-2) / 0.07) 0%, transparent 55%)',+ '--port-body-size': 'cover, cover',+ '--port-body-overlay-opacity': '1',+ '--port-app-backdrop': 'transparent',+ '--port-sidebar-bg': 'rgb(255 255 255 / 0.9)',+ '--port-input-bg': 'rgb(255 255 255 / 0.92)',+ '--port-control-bg': 'rgb(244 246 252 / 0.96)',+ '--port-control-bg-hover': 'rgb(228 232 246 / 0.98)',+ '--port-control-border': 'rgb(var(--port-border) / 0.3)',+ '--port-active-bg': 'linear-gradient(90deg, rgb(var(--port-accent) / 0.14), rgb(var(--port-accent-2) / 0.08))',+ '--port-hover-bg': 'rgb(var(--port-accent) / 0.07)',+ '--port-terminal-bg': 'rgb(246 247 252)',+ '--port-terminal-text': 'rgb(32 38 66)',+ '--port-chart-1': '14 124 140',+ '--port-chart-2': '181 23 143',+ '--port-chart-3': '161 98 7',+ '--port-chart-4': '21 128 61',+ '--port-chart-grid': '14 124 140',+ '--port-fx-scanline-color': 'rgb(var(--port-accent) / 0.05)',+ '--port-fx-scanline-period': '3px',+ '--port-fx-overlay-blend': 'multiply',+ '--port-fx-overlay-opacity': '0.6',+ '--port-fx-grid-floor-x': 'rgb(var(--port-accent-2) / 0.2)',+ '--port-fx-grid-floor-y': 'rgb(var(--port-accent) / 0.22)',+ '--port-fx-grid-floor-opacity': '0.6',+ '--port-fx-grid-floor-duration': '12s',+ },+ },};export const THEME_IDS = Object.keys(THEMES);diff --git a/client/src/themes/portosThemes.test.js b/client/src/themes/portosThemes.test.jsindex 236049cb21..80cdc9bcb2 100644--- a/client/src/themes/portosThemes.test.js+++ b/client/src/themes/portosThemes.test.js@@ -1,5 +1,8 @@import { describe, it, expect } from 'vitest';-import { DEFAULT_AVATAR_COLOR, DEFAULT_THEME_ID, THEMES } from './portosThemes.js';+import { readFileSync } from 'node:fs';+import { fileURLToPath } from 'node:url';+import { dirname, join } from 'node:path';+import { DEFAULT_AVATAR_COLOR, DEFAULT_THEME_ID, THEMES, THEME_EFFECTS } from './portosThemes.js';// WCAG 2.x relative luminance + contrast ratio, computed straight from the// stored "R G B" token strings so the assertion proves the on-disk theme@@ -101,14 +104,14 @@ describe('portosThemes warning token contrast', () => {);});-describe('shared eight-theme color contract', () => {+describe('shared ten-theme color contract', () => {const entries = Object.values(THEMES);- it('keeps four day/night variants on the same token surface', () => {- expect(entries).toHaveLength(8);- expect(entries.filter((theme) => theme.mode === 'day')).toHaveLength(4);- expect(entries.filter((theme) => theme.mode === 'night')).toHaveLength(4);- expect(new Set(entries.map((theme) => theme.family))).toEqual(new Set(['classic', 'glass', 'terminal', 'blueprint']));+ it('keeps five day/night variants on the same token surface', () => {+ expect(entries).toHaveLength(10);+ expect(entries.filter((theme) => theme.mode === 'day')).toHaveLength(5);+ expect(entries.filter((theme) => theme.mode === 'night')).toHaveLength(5);+ expect(new Set(entries.map((theme) => theme.family))).toEqual(new Set(['classic', 'glass', 'terminal', 'blueprint', 'kestrel']));});it.each(entries.map((theme) => [theme.id, theme]))(@@ -242,6 +245,25 @@ describe('content cards read as raised surfaces in every theme', () => {);});+describe('theme effects', () => {+ const css = readFileSync(join(dirname(fileURLToPath(import.meta.url)), '..', 'index.css'), 'utf8');++ it('every effect a theme lists is a shared effect with a CSS block keyed on the effects attribute', () => {+ for (const theme of Object.values(THEMES)) {+ for (const effect of theme.effects ?? []) {+ expect(THEME_EFFECTS, `${theme.id} lists ${effect}`).toContain(effect);+ }+ }+ for (const effect of THEME_EFFECTS) {+ expect(css).toContain(`[data-port-theme-effects~="${effect}"]`);+ }+ });++ it('is exercised by at least one theme (guards the loop above from vacuously passing)', () => {+ expect(Object.values(THEMES).some((theme) => theme.effects?.length)).toBe(true);+ });+});+describe('DEFAULT_AVATAR_COLOR', () => {it('is a literal #rrggbb hex — a native <input type="color"> rejects anything else', () => {expect(DEFAULT_AVATAR_COLOR).toMatch(/^#[0-9a-f]{6}$/);diff --git a/docs/plans/2026-09-04-kestrel-neon-theme.md b/docs/plans/2026-09-04-kestrel-neon-theme.mdnew file mode 100644index 0000000000..8b3388d12d--- /dev/null+++ b/docs/plans/2026-09-04-kestrel-neon-theme.md@@ -0,0 +1,66 @@+# Kestrel Neon theme, shared theme effects, and the Core Assembly avatar++## Context++A single-file "boot terminal" concept (cyan `#00f0ff` and magenta `#ff2bd6` on+`#05060a`; every glow a text-shadow, every scanline a gradient; a perspective+grid floor; a rotating wireframe icosahedron in a telemetry panel) was the+brief for a new PortOS theme with day and night variants. Its icosahedron+became a new Chief of Staff avatar.++Two things about the existing theme system got in the way and were fixed as+part of the work rather than worked around:++- Every full-screen effect (Black ICE's scanlines, Lumen Glass Day's drift) was+ a bespoke `html[data-port-theme="<id>"]` block, so a day/night pair+ duplicated its effect CSS and a new theme could not reuse an effect without+ copying it.+- `applyTheme` only ever *set* custom properties on `<html>`. Because every+ theme declared the same token set that never showed, but the moment a theme+ declares an optional token, switching away leaves it inline on `<html>` and+ it leaks into the next theme.++## Design++**Theme family `kestrel`** (`client/src/themes/portosThemes.js`):+`kestrel-neon` (night) and `kestrel-neon-day` ("Kestrel Dawn"). IBM Plex Mono+for UI, display, and code — the concept is a terminal. Palettes graded by the+existing contrast contract (`portosThemes.test.js`, `chipContrast.test.js`,+`npm run theme:check`). Day darkens magenta to `#b5178f` and swaps cyan for teal+`#0e7c8c` so the two-ink identity survives on white.++**Shared effects layer** (`client/src/index.css`, "Theme effects layer"):+a theme lists effects in its manifest (`effects: [...]`, registry+`THEME_EFFECTS`); `useTheme` publishes them as `data-port-theme-effects` on+`<html>`; each effect is one block keyed on+`html[data-port-theme-effects~="<name>"]` and parameterized by `--port-fx-*`+tokens defaulted in `:root`. The three overlay effects (scanlines, vignette,+sweep) share one `body::after` and compose as a single background list;+unlisted effects resolve to a transparent layer. `grid-floor` lives on+`#root::before` because `body::before` is the token-driven backdrop and a+background image cannot be tilted. `glitch` animates `h1`. Every animation is+off under `prefers-reduced-motion`. Black ICE Terminal's scanlines moved onto+the shared layer with identical values, so it renders as before.++**`applyTheme` clears stale tokens**: it remembers the properties it set and+removes any the next theme does not declare (`useTheme.test.jsx` pins both the+effects attribute and the clearing).++**Core Assembly avatar** (`client/src/components/cos/CoreCoSAvatar.jsx`,+style id `core`): a plain 2D canvas, so it needs no WebGL and skips+`CoSCanvasGuard`. Geometry and the frame renderer are pure+(`client/src/lib/wireframeCore.js`). Edges take the agent-state color (the+intentional 7-way `AGENT_STATES` enum); rings and vertices follow+`--port-accent-2`, re-resolved on theme switch through the same+`data-port-theme` mutation signal `useCanvasRollPalette` watches. Spin and glow+scale per state, `speaking` bursts both, drag rotates, and reduced motion holds+one static frame. It is theme-independent: pick it under any theme.++## Verification++- `npm run theme:check`; `portosThemes`, `chipContrast`, `useTheme`,+ `wireframeCore`, `CoreCoSAvatar`, `ConfigTab`, `ChiefOfStaff`, and the server+ `cosStatusRoutesAvatar` suites; full client and server suites.+- Built the client and screenshotted a static preview of both variants, Black+ ICE, and Classic Midnight against the built stylesheet to confirm the effects+ attribute, the shared overlay, the grid floor geometry, and the avatar frame.diff --git a/docs/themes/README.md b/docs/themes/README.mdindex 53fb64083c..f2e3dcfb4a 100644--- a/docs/themes/README.md+++ b/docs/themes/README.md@@ -2,11 +2,12 @@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:+The current production UI remains available as `classic-midnight`. The re-imagined concepts are:- `lumen-glass` - translucent glass control room.- `black-ice-terminal` - dense cyberpunk terminal.- `blueprint-ops` - systems-map drafting interface.+- `kestrel-neon` - CRT boot terminal with a neon grid floor.## Integration Contract@@ -22,7 +23,7 @@ New UI should use semantic PortOS tokens wherever possible:- 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 eight theme variants.+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 ten theme variants.The shared CSS contract keeps surface text between **4.5:1 and 15.5:1** against both the page and minimum card surfaces. The lower bound protects readability; the upper bound avoids glare from unnecessary near-white/near-black pairings. Solid legacy neutral backgrounds (`bg-gray-800` through `bg-gray-500` and their zinc/neutral/slate equivalents) are aliases of the theme surface tokens. Fixed media, scrims, terminals, and canvas overlays are the documented exceptions and must keep their own explicit overlay contract.@@ -54,11 +55,29 @@ For a nested panel, prefer `bg-port-bg` at full strength over `bg-port-bg/40`: aThe 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.+Only the tokens the active theme declares stay on `<html>`: `applyTheme` removes every custom property the previous theme set that the next one does not, so an optional token (an effect color, say) cannot leak across a switch.++## Effects++Full-screen effects are shared primitives, not per-theme CSS. A theme lists the ones it wants in its manifest and tunes them with `--port-fx-*` tokens; `useTheme` publishes the list as `data-port-theme-effects` on `<html>`, and `index.css` keys one block per effect on `html[data-port-theme-effects~="<name>"]`.++| Effect | Where it paints | Tokens |+| --- | --- | --- |+| `scanlines` | CRT line overlay above the app (`body::after`) | `--port-fx-scanline-color`, `--port-fx-scanline-period`, `--port-fx-scanline-thickness` |+| `vignette` | darkened viewport edges on that overlay | `--port-fx-vignette-color` |+| `sweep` | a phosphor band drifting down that overlay | `--port-fx-sweep-color`, `--port-fx-sweep-duration` |+| `grid-floor` | a perspective grid receding under the page (`#root::before`) | `--port-fx-grid-floor-x`, `--port-fx-grid-floor-y`, `--port-fx-grid-floor-opacity`, `--port-fx-grid-floor-duration` |+| `glitch` | periodic chromatic split on page titles (`h1`) | `--port-fx-glitch-period` |++The three overlay effects share one `body::after` and compose in a single background list, governed by `--port-fx-overlay-blend` and `--port-fx-overlay-opacity`; an effect the theme did not list resolves to a transparent layer. Every effect animation is disabled under `prefers-reduced-motion`. `THEME_EFFECTS` in `portosThemes.js` is the registry — `npm run theme:check` fails on an unknown name and on a registered effect with no CSS block. Adding an effect means: a name in `THEME_EFFECTS`, one `html[data-port-theme-effects~="<name>"]` block with its tokens defaulted in `:root`, and a row here.++Black ICE Terminal (both modes) uses `scanlines`; Kestrel Neon uses all five, and Kestrel Dawn `scanlines` + `grid-floor`.+## New Feature ChecklistBefore merging UI work:-1. Test the feature in `classic-midnight`, `lumen-glass`, `black-ice-terminal`, and `blueprint-ops`.+1. Test the feature in `classic-midnight`, `lumen-glass`, `black-ice-terminal`, `blueprint-ops`, and `kestrel-neon`.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.@@ -71,3 +90,4 @@ Before merging UI work:- [Lumen Glass](./lumen-glass.md)- [Black ICE Terminal](./black-ice-terminal.md)- [Blueprint Ops](./blueprint-ops.md)+- [Kestrel Neon](./kestrel-neon.md)diff --git a/docs/themes/kestrel-neon.md b/docs/themes/kestrel-neon.mdnew file mode 100644index 0000000000..2358442a9c--- /dev/null+++ b/docs/themes/kestrel-neon.md@@ -0,0 +1,35 @@+# Kestrel Neon++## Intent++Kestrel Neon turns PortOS into a CRT boot terminal: a scanlined void, a perspective grid floor receding under the page, cyan wireframes, and magenta panel labels. It borrows its palette and effects from a single-file "boot terminal" concept (cyan `#00f0ff` and magenta `#ff2bd6` on `#05060a`, every glow a text-shadow, every scanline a gradient) and reads as the machine-room view of an agent runtime — logs, orchestration, telemetry.++The day variant, **Kestrel Dawn**, keeps the geometry and the two-ink identity but prints it in daylight: holographic white panels on a pale lavender page, teal ink where night had cyan, magenta darkened for contrast, the grid floor faded to a watermark, no sweep or glitch.++Both variants use IBM Plex Mono for UI, display, and code — the concept is a terminal, so the whole interface is monospaced.++## Integration Rules++- Cyan (`--port-accent`) is the primary voice: selection, focus, links, live values. Magenta (`--port-accent-2`) is the secondary voice: panel borders, labels, active-nav rules, AI-generated or recommendation content. Do not swap the two inside a component.+- Amber is attention, green is healthy, rose is failure — the reference terminal's `[WARN]` / `[ OK ]` / error vocabulary. Keep status badges text-labelled; the neon hues are close in brightness at a glance.+- Surfaces are near-black with a magenta hairline; do not add your own borders in hard-coded colors. `bg-port-card border border-port-border` picks up the theme's top-edge cyan wash automatically.+- Corners are square (`--port-radius-*` near zero). Do not round custom containers by hand.+- The effects are the shared `scanlines`, `vignette`, `sweep`, `grid-floor`, and `glitch` primitives (see the Effects section of the themes README), tuned through the `--port-fx-*` tokens in the manifest. The scanline and vignette overlay sits at `z-index: 9998` with `pointer-events: none` and `mix-blend-mode: multiply`; fixed media (video, canvases) will show faint lines through it. That is the theme. Do not raise a component above it to escape.+- Text carries a faint glow. Avoid thin (300-weight) type and avoid text under ~11px in custom components — the glow softens small glyphs.++## Component Notes++- `h1` renders uppercase with wide tracking and a periodic chromatic glitch (night only; disabled under `prefers-reduced-motion`). Keep page titles short — they are shouted.+- The active sidebar item gets a magenta left rule and a cyan text glow.+- Inputs and code blocks use a cyan caret and a soft cyan text glow; the focus ring is a one-pixel cyan line plus an 18px glow rather than a thick halo.+- Charts: series 1 cyan, 2 magenta, 3 amber, 4 green; grid lines cyan at 34%.+- The **Core Assembly** CoS avatar (`avatarStyle: 'core'`) is this theme's telemetry widget — a rotating, depth-shaded wireframe icosahedron on a 2D canvas whose edges take the agent-state color and whose rings and vertices follow `--port-accent-2`. It is theme-independent (pick it under any theme) and needs no WebGL.+- Day mode: the grid floor is a watermark and the scanlines are a 5% teal multiply, so photographs and thumbnails stay clean. No sweep, no glitch.++## Validation++- Check the full-page overlay against modals, toasts, and drawers: they must stay legible through the scanlines (contrast tokens are graded against the page and card fills, not the overlay).+- Verify `h1` uppercase does not overflow narrow headers on mobile; long titles wrap rather than truncate.+- Confirm the grid floor sits behind fixed-bottom bars and does not paint over the sidebar on small widths.+- Test the CoS page with `core` selected, in both day and night, and with `prefers-reduced-motion` on (the avatar must render one static frame).+- Run `npm run theme:check` and the `portosThemes` / `chipContrast` suites; the day variant's magenta and teal inks are tuned to the 30% tonal-fill contrast floor and will fail if lightened.diff --git a/scripts/check-themes.js b/scripts/check-themes.jsindex da33ee141a..f2965a5950 100644--- a/scripts/check-themes.js+++ b/scripts/check-themes.js@@ -5,6 +5,7 @@ import { fileURLToPath } from 'node:url';import {DEFAULT_THEME_ID,LEGACY_THEME_ALIASES,+ THEME_EFFECTS,THEME_IDS,THEMES,getTheme,@@ -123,6 +124,10 @@ async function main() {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 effect of theme.effects ?? []) {+ assert(THEME_EFFECTS.includes(effect), `${id} lists unknown effect ${effect}`);+ }+assert(isPlainObject(theme.colors), `${id} colors must be a plain object`);assert(isPlainObject(theme.tokens), `${id} tokens must be a plain object`);@@ -149,6 +154,9 @@ async function main() {);}assert(css.includes('data-port-theme'), 'index.css must include the theme runtime layer');+ for (const effect of THEME_EFFECTS) {+ assert(css.includes(`data-port-theme-effects~="${effect}"`), `index.css has no shared block for effect ${effect}`);+ }console.log(`Theme contract OK: ${THEME_IDS.join(', ')}`);}