Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
feat(theme): warm the light palette so it stops glaring
enescd5dc38e390d
diff --git a/src/renderer/styles.css b/src/renderer/styles.cssindex 6a556a68b..d22d19920 100644--- a/src/renderer/styles.css+++ b/src/renderer/styles.css@@ -93,46 +93,69 @@is greyer and what comes forward goes white. */:root[data-theme='light'] {color-scheme: light;- --tint-rgb: 0, 0, 0;- --text-strong: #000;-- --bg: #ffffff; /* content / canvas */- --panel: #f5f5f7; /* bars, panels, node chrome */- --panel-header: #ebebf0; /* elevated / hover */- --panel-2: #ebebf0;- --surface-black: #f7f7f9;- --surface-sunken: #f0f0f3; /* wells stay GREYER than the page */- --surface-deep: #e8e8ed;- --surface-raised: #ffffff; /* …while raised surfaces come up to white */- --surface-overlay: #ffffff;++ /* WARM, not white. The first light palette was pure #fff surfaces with pure black ink — the+ brightest thing a screen can do — which reads as glare in a full-window canvas app somebody+ sits in front of all day. Two changes fix it TOGETHER, and neither works alone:+ 1. every surface carries a cream cast and none of them reaches 255; the brightest thing+ here is #fdfbf7, and the canvas behind the nodes is darker still;+ 2. the INK is a warm near-black, not #000 — which is what stops the contrast reading like+ print on paper.+ `--tint-rgb` does the second job for the entire sheet at once: text, borders, hover fills and+ gradient stops are all mixed from it (see the dark block's note). */+ --tint-rgb: 58, 48, 38;+ --text-strong: #2b241c;++ /* Warmth costs contrast — brown on cream is a shorter range than black on white — so the+ secondary alphas are raised to buy it back rather than left at the dark theme's values.+ `--muted` at 0.55 measured 3.2:1 against `--bg`, under the 4.5:1 floor for body text; 0.7+ puts it at 4.9:1, and `--text` at 0.85 is 7.7:1. These floors are asserted, not assumed —+ see the contrast block in styles.theme.test.ts. */+ --border: rgba(var(--tint-rgb), 0.14);+ --muted: rgba(var(--tint-rgb), 0.7);+ --muted-2: rgba(var(--tint-rgb), 0.4);++ --bg: #fbf8f3; /* content / canvas */+ --panel: #f3efe7; /* bars, panels, node chrome */+ --panel-header: #eae5db; /* elevated / hover */+ --panel-2: #eae5db;+ --surface-black: #f5f1ea;+ --surface-sunken: #efeae1; /* wells stay DARKER than the page */+ --surface-deep: #e6e0d4;+ --surface-raised: #fdfbf7; /* …while raised surfaces come up, but never to pure white */+ --surface-overlay: #fdfbf7;/* systemBlue's light-mode value — the dark one is deliberately lighter for a dark field and- loses contrast against white. */+ loses contrast against a pale one. Kept BLUE on a warm field: the accent is the product's+ identity across both themes and is user-configurable (Settings → Appearance), so it is not+ the palette's job to change it. */--accent: #007aff;--accent-hover: #0a6ed1;- /* Accent as text has to DARKEN on white, where the dark theme's lightened blue disappears. */+ /* Accent as text has to DARKEN here, where the dark theme's lightened blue disappears. */--accent-text: #0060df;- /* Off-white, and slightly greyer than a node's own surface, so nodes keep their edges instead- of dissolving into the field. */- --canvas-bg: #f7f7fa;- /* Floating surfaces come UP to near-white in light (see the elevation note above). */- --menu-rgb: 252, 252, 254;- --popover-rgb: 255, 255, 255;- --card-rgb: 252, 252, 254;- /* macOS light-mode shadows are a third of the weight of its dark ones. */+ /* The canvas sits BELOW every node, so it is the one surface that must be darker than the+ panels — otherwise the nodes dissolve into the field and the layout loses its edges. */+ --canvas-bg: #f4efe6;+ /* Floating surfaces come UP the ramp (see the elevation note above) without going white. */+ --menu-rgb: 253, 251, 247;+ --popover-rgb: 253, 251, 247;+ --card-rgb: 253, 251, 247;+ /* macOS light-mode shadows are about a third of the weight of its dark ones. */--shadow-k: 0.35;- /* The status hues are tuned for a dark field: on white, yellow and orange fall under any- reasonable contrast floor. Darkened here rather than at each of their ~50 call sites. */- --danger: #d70015;- --warn: #b25000;- --caution: #8a6d00;- --success: #1c8b34;-- /* Canvas dots read as grid, not as noise: on white the dark-mode grey is far too heavy. */- --canvas-dot: #d0d0d6;- --minimap-mask: rgba(255, 255, 255, 0.6);+ /* The status hues are tuned for a dark field: on a pale one, yellow and orange fall under any+ reasonable contrast floor. Darkened here rather than at each of their ~50 call sites, and+ warmed a little so they belong to this palette. */+ --danger: #c62a1f;+ --warn: #a85c00;+ --caution: #806100;+ --success: #1f7a38;++ /* Dots must read as a grid, not as noise: the dark-mode grey is far too heavy on a pale field,+ and a neutral one would be the only cold thing on screen. */+ --canvas-dot: #d8cdba;+ --minimap-mask: rgba(251, 248, 243, 0.6);}* {diff --git a/src/renderer/styles.theme.test.ts b/src/renderer/styles.theme.test.tsindex c6851f0d4..4646bc2d2 100644--- a/src/renderer/styles.theme.test.ts+++ b/src/renderer/styles.theme.test.ts@@ -126,3 +126,83 @@ describe('the light theme overrides every themeable token', () => {expect(missing).toEqual([])})})++/**+ * Contrast floors for the LIGHT palette.+ *+ * The light theme was re-tuned warm because pure white surfaces with pure black ink read as glare.+ * Warmth costs contrast — brown on cream is a shorter range than black on white — so the numbers+ * that made the re-tune safe are asserted here rather than claimed in a comment. Nudging a surface+ * a few points paler, or an ink alpha down, is exactly the kind of change that looks harmless and+ * quietly drops body text under the floor.+ */+describe('light palette contrast', () => {+ const LIGHT = CSS.slice(CSS.indexOf(":root[data-theme='light']"), TOKEN_BLOCK_END)++ function token(name: string): string {+ const m = new RegExp(`^\\s*${name}\\s*:\\s*([^;]+);`, 'm').exec(LIGHT)+ if (!m) throw new Error(`light block has no ${name}`)+ return m[1].trim()+ }++ const INK = token('--tint-rgb').split(',').map((n) => +n.trim()) as [number, number, number]++ function hex(h: string): [number, number, number] {+ const s = h.replace('#', '')+ return [0, 2, 4].map((i) => parseInt(s.slice(i, i + 2), 16)) as [number, number, number]+ }+ /** The ink at alpha `a`, composited over an opaque surface. */+ function inkOver(a: number, bg: [number, number, number]): [number, number, number] {+ return bg.map((c, i) => INK[i] * a + c * (1 - a)) as [number, number, number]+ }+ function luminance([r, g, b]: [number, number, number]): number {+ const f = (c: number): number => {+ const v = c / 255+ return v <= 0.03928 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4+ }+ return 0.2126 * f(r) + 0.7152 * f(g) + 0.0722 * f(b)+ }+ function contrast(a: [number, number, number], b: [number, number, number]): number {+ const [hi, lo] = [luminance(a), luminance(b)].sort((x, y) => y - x)+ return (hi + 0.05) / (lo + 0.05)+ }+ /** The alpha out of `rgba(var(--tint-rgb), α)`. */+ function inkAlpha(name: string): number {+ const m = /rgba\(var\(--tint-rgb\),\s*([\d.]+)\)/.exec(token(name))+ if (!m) throw new Error(`${name} is not mixed from --tint-rgb`)+ return +m[1]+ }++ // The two surfaces body text actually sits on. `--surface-deep` is the deepest chrome (dock,+ // modal shells) and carries labels rather than prose, so it is held to the 3:1 large-text floor.+ const SURFACES: [string, [number, number, number]][] = [+ ['--bg', hex(token('--bg'))],+ ['--panel', hex(token('--panel'))],+ ['--canvas-bg', hex(token('--canvas-bg'))]+ ]++ it.each(SURFACES)('body text clears WCAG AA on %s', (_name, bg) => {+ expect(contrast(inkOver(inkAlpha('--text'), bg), bg)).toBeGreaterThanOrEqual(4.5)+ })++ it.each(SURFACES)('secondary text clears WCAG AA on %s', (_name, bg) => {+ // This is the one the warm re-tune nearly broke: the dark theme's 0.55 measured 3.2:1 here.+ expect(contrast(inkOver(inkAlpha('--muted'), bg), bg)).toBeGreaterThanOrEqual(4.5)+ })++ it.each(SURFACES)('the status hues and link accent stay legible on %s', (_name, bg) => {+ for (const t of ['--accent-text', '--danger', '--warn', '--caution', '--success']) {+ expect(contrast(hex(token(t)), bg), `${t}`).toBeGreaterThanOrEqual(4.3)+ }+ })++ it('no light surface is pure white — that brightness is the glare being avoided', () => {+ for (const t of ['--bg', '--panel', '--surface-raised', '--surface-overlay', '--canvas-bg']) {+ expect(luminance(hex(token(t))), t).toBeLessThan(0.97)+ }+ })++ it('the canvas sits below the panels, so nodes keep their edges', () => {+ expect(luminance(hex(token('--canvas-bg')))).toBeLessThan(luminance(hex(token('--bg'))))+ })+})diff --git a/src/renderer/terminal/themes.ts b/src/renderer/terminal/themes.tsindex 606ee05a1..41e8ae671 100644--- a/src/renderer/terminal/themes.ts+++ b/src/renderer/terminal/themes.ts@@ -252,6 +252,40 @@ export const TERMINAL_THEMES: readonly TerminalTheme[] = [brightWhite: '#fdf6e3'}},+ {+ id: 'nodeterm-light',+ label: 'nodeterm Light',+ dark: false,+ theme: {+ // The counterpart to `nodeterm-dark`: this background IS the light app palette's `--bg`, so+ // picking it — which is also what flips the chrome light, via appTheme 'auto' — leaves the+ // terminal and the window around it the same colour, instead of a pale rectangle sitting on+ // cream. Deliberately not white; see the light block in styles.css for why.+ background: '#fbf8f3',+ foreground: '#3a3028',+ cursor: '#5c4a38',+ cursorAccent: '#fbf8f3',+ selectionBackground: '#e6dcc9',+ black: '#3a3028',+ red: '#b03a2e',+ green: '#4a7c2f',+ yellow: '#9a6b00',+ blue: '#2a6099',+ magenta: '#8b4a8b',+ cyan: '#1f7a7a',+ // "white" on a pale field cannot BE white or it vanishes: it steps down to a warm grey, and+ // brightWhite goes darker still so an agent CLI's emphasis text stays readable.+ white: '#8a7d6b',+ brightBlack: '#7a6d5c',+ brightRed: '#c9503f',+ brightGreen: '#5c9440',+ brightYellow: '#b07d00',+ brightBlue: '#3a7ab8',+ brightMagenta: '#a05ca0',+ brightCyan: '#2a9494',+ brightWhite: '#3a3028'+ }+ },{id: 'catppuccin-latte',label: 'Catppuccin Latte',