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
fix(glass): size the status-chip wash so badge labels keep 4.5:1
iceclatterWT943d2c650293
diff --git a/src/renderer/lib/glassContrast.test.ts b/src/renderer/lib/glassContrast.test.tsindex 22adae76a..ad27f2382 100644--- a/src/renderer/lib/glassContrast.test.ts+++ b/src/renderer/lib/glassContrast.test.ts@@ -23,7 +23,10 @@ import {glassSurfaceAlpha,snapGlassSlider,stepGlassSlider,- keepGlassBlurWhileMoving+ keepGlassBlurWhileMoving,+ glassChipWash,+ GLASS_CHIP_HUES,+ GLASS_CHIP_WASH_MAX} from './glassContrast'const WHITE = [255, 255, 255] as const@@ -239,3 +242,30 @@ describe('Keep blur while moving', () => {expect(body).toContain('if (keepBlurWhileMovingRef.current) return')})})++describe('glass status chip keeps its label readable', () => {+ const rows = TERMINAL_THEMES.map((t) => {+ const readable = glassTintAlpha(t.theme.foreground!, t.theme.background!)+ return [t.id, t, readable, glassChipWash(t.theme.foreground!, t.theme.background!, readable)] as const+ })++ it.each(rows)('%s: the chip wash keeps the foreground at 4.5:1 for every badge hue', (_id, t, readable, wash) => {+ const fg = parseHex(t.theme.foreground!)!+ const bg = parseHex(t.theme.background!)!+ expect(wash).toBeLessThanOrEqual(GLASS_CHIP_WASH_MAX)+ if (readable >= 1) return // Solarized Light: under 4.5 even opaque; the tint is its whole answer+ for (let v = 0; v <= 255; v += 3) {+ const head = composite(bg, composite(bg, [v, v, v], readable), 0.35)+ for (const h of GLASS_CHIP_HUES) {+ expect(contrastRatio(fg, composite(parseHex(h)!, head, wash))).toBeGreaterThanOrEqual(4.5)+ }+ }+ })++ it('the stylesheet uses the computed wash, never a fixed one', () => {+ const css = readFileSync(join(__dirname, '..', 'styles.css'), 'utf8')+ const rule = css.slice(css.indexOf(":root[data-nt-glass='on'] .term-node__status {"))+ const body = rule.slice(0, rule.indexOf('}'))+ expect(body).toContain('color-mix(in srgb, currentColor var(--term-glass-chip-wash, 0%), transparent)')+ })+})diff --git a/src/renderer/lib/glassContrast.ts b/src/renderer/lib/glassContrast.tsindex cd1e3baa3..271df84e6 100644--- a/src/renderer/lib/glassContrast.ts+++ b/src/renderer/lib/glassContrast.ts@@ -104,11 +104,57 @@ export function glassTintAlpha(fg: string, tint: string, minRatio = 4.5): numberreturn Math.max(GLASS_ALPHA_MIN, lowest)}+/* Status chips on a glass header (styles.css `.term-node__status` under Liquid Glass): the label+ is the terminal foreground, and the chip behind it is a wash of the status hue. The wash moves+ the surface under the text, so it gets the same treatment as the tint: the LARGEST wash (up to+ GLASS_CHIP_WASH_MAX) at which the foreground keeps 4.5:1 for every hue a badge can take, over+ any backdrop. A fixed wash cannot do it — measured, One Dark's yellow chip falls to 3.93:1 at+ 12% — and a theme with no margin (Solarized Dark) gets 0, where the chip is its ring alone. */+export const GLASS_CHIP_WASH_MAX = 0.24+/** Every hue a glass status badge can be: the text-safe and fill tokens those badges read under+ * Liquid Glass, dark then light values (styles.palette.test.ts pins them to the stylesheet). */+export const GLASS_CHIP_HUES = [+ '#30d158', '#6cb0ff', '#ff9f0a', '#ff453a', '#ffd60a', '#98989d', '#bf5af2',+ '#1f7a38', '#0060df', '#a85c00', '#c62a1f', '#34c759', '#806100', '#8e8e93', '#af52de'+]+/** The glass header's own layer over the node tint (see `glassTint().header`). */+const HEADER_LAYER_ALPHA = 0.35+const CHIP_BACKDROPS: Rgb[] = (() => {+ const out: Rgb[] = []+ for (const r of [0, 255]) for (const g of [0, 255]) for (const b of [0, 255]) out.push([r, g, b])+ for (let v = 0; v <= 255; v += 5) out.push([v, v, v])+ return out+})()+const chipWashCache = new Map<string, number>()++/** Largest status-chip wash keeping `fg` at 4.5:1 on a glass header tinted `bg` at `alpha`. */+export function glassChipWash(fg: string, bg: string, alpha: number): number {+ const key = `${fg}|${bg}|${alpha.toFixed(3)}`+ const hit = chipWashCache.get(key)+ if (hit !== undefined) return hit+ const f = parseHex(fg)+ const b = parseHex(bg)+ const hues = GLASS_CHIP_HUES.map((h) => parseHex(h)!)+ let best = 0+ if (f && b) {+ const heads = CHIP_BACKDROPS.map((d) => composite(b, composite(b, d, alpha), HEADER_LAYER_ALPHA))+ for (let i = 1; i <= Math.round(GLASS_CHIP_WASH_MAX * 100); i++) {+ const w = i / 100+ if (!heads.every((h) => hues.every((hue) => contrastRatio(f, composite(hue, h, w)) >= 4.5))) break+ best = w+ }+ }+ chipWashCache.set(key, best)+ return best+}+export interface GlassTint {/** The node's glass fill, `rgba(r, g, b, a)`. */background: string/** The header's extra layer on top of it — slightly more opaque in total. */header: string+ /** The status-chip wash for this theme, as a CSS percentage (`glassChipWash`). */+ chipWash: string/** The theme foreground: header text sits on the TERMINAL's tint, so it takes the terminal's* text colour, not the app's (a light app theme over a dark terminal theme measured 1.31:1). */foreground: string@@ -124,11 +170,15 @@ export function glassTint(const bg = theme.background ? parseHex(theme.background) : nullif (!bg) return nullconst foreground = theme.foreground ?? '#ffffff'- const alpha = glassSurfaceAlpha(slider, glassTintAlpha(foreground, theme.background!), a11y)+ const readable = glassTintAlpha(foreground, theme.background!)+ const alpha = glassSurfaceAlpha(slider, readable, a11y)const rgb = bg.join(', ')+ // Left of the Readable tick the contrast promise is off anyway; size the chip for the tick.+ const chipWash = glassChipWash(foreground, theme.background!, Math.max(alpha, readable))return {background: `rgba(${rgb}, ${alpha.toFixed(3)})`,- header: `rgba(${rgb}, 0.35)`,+ header: `rgba(${rgb}, ${HEADER_LAYER_ALPHA})`,+ chipWash: `${Math.round(chipWash * 100)}%`,foreground}}diff --git a/src/renderer/nodes/TerminalNode.tsx b/src/renderer/nodes/TerminalNode.tsxindex 0e97169c8..d9020642a 100644--- a/src/renderer/nodes/TerminalNode.tsx+++ b/src/renderer/nodes/TerminalNode.tsx@@ -1259,6 +1259,7 @@ export function TerminalNode({? ({'--term-glass-bg': tint.background,'--term-glass-header-bg': tint.header,+ '--term-glass-chip-wash': tint.chipWash,'--term-glass-fg': tint.foreground} as React.CSSProperties): nulldiff --git a/src/renderer/styles.css b/src/renderer/styles.cssindex 3b10b3d1c..6e4927113 100644--- a/src/renderer/styles.css+++ b/src/renderer/styles.css@@ -13724,7 +13724,10 @@ body.focus-mode .dock:hover {`color`, and so `currentColor`, keeps the status hue for the chip and the dot. */:root[data-nt-glass='on'] .term-node__status {-webkit-text-fill-color: var(--text);- background: color-mix(in srgb, currentColor 24%, transparent);+ /* The wash is sized per terminal theme so the label keeps 4.5:1 (lib/glassContrast.ts+ `glassChipWash`); the ring carries the hue when a theme has no margin for a wash. */+ background: color-mix(in srgb, currentColor var(--term-glass-chip-wash, 0%), transparent);+ box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 55%, transparent);padding: 1px 6px;border-radius: 999px;}diff --git a/src/renderer/styles.theme.test.ts b/src/renderer/styles.theme.test.tsindex 457ef87bc..4ccc1fb7a 100644--- a/src/renderer/styles.theme.test.ts+++ b/src/renderer/styles.theme.test.ts@@ -109,6 +109,7 @@ describe('every CSS variable resolves', () => {'--term-glass-bg', // TerminalNode, glass tint per node theme (lib/glassContrast.ts)'--term-glass-header-bg','--term-glass-fg',+ '--term-glass-chip-wash', // TerminalNode, status-chip wash per theme (glassChipWash)'--glass-chrome-bg', // App.tsx, Liquid Glass chrome fill (lib/glassContrast.ts glassChromeAlpha)'--glass-fill', // GlassSlider, the slider value (fills the track)'--glass-tick', // GlassSlider, the Readable tick position (the notch)