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): readable Liquid Glass at every slider position, clearer Clear
Dev Goswamifdd990918849
diff --git a/CLAUDE.md b/CLAUDE.mdindex fc24cfa36..3b395f8af 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -7125,8 +7125,9 @@ glass never sits over plain black; a wallpaper the user chose is never replaced.backgrounds opaque); the settings preview never does. Glass stands down while a shared glyph grid ismounted (it paints text BELOW the nodes, so a tint would cover it), and, only when **Keep blur whilemoving** is off, the blur is dropped while the camera moves (`.canvas-moving`, toggled by- `onMoveStart`/`onMoveEnd` via classList so a pan does not re-render Canvas) — the tint alone- carries the contrast guarantee.+ `onMoveStart`/`onMoveEnd` via classList so a pan does not re-render Canvas). Only the blur+ pauses: nodes keep their backdrop squeeze (see **Backdrop squeeze**), which is what holds the text+ left of the Readable tick.- **App-painted cell backgrounds become glass** (`terminal/glass-cell-backgrounds.ts`). addon-webgl0.18.0 paints every background rectangle at alpha 1 (`RectangleRenderer._updateRectangle`,`$a = 1`), so full-screen TUIs read as slabs: Grok's `48;2;20;20;20` screen fill, Codex's composer,@@ -7292,22 +7293,45 @@ glass never sits over plain black; a wallpaper the user chose is never replaced.glass header are ink over a tinted chip (`-webkit-text-fill-color: var(--text)` with the chipmixed from `currentColor`), not coloured text. `styles.palette.test.ts` pins the mapping and thatno two meanings resolve to the same colour, in both themes.+- **Backdrop squeeze: readable at every slider position** (`glassBackdropRange`,+ `glassChromeBackdropRange`, `glassBackdropFilter` in `glassContrast.ts`). Left of the tick the+ tint alone measured about 1:1 at Clear (dark text over a black wallpaper, light text over a white+ one). So each glass node appends a colour-matrix filter that squeezes the backdrop into a range+ the tint can cover: light glass lifts it to a floor (`contrast(c) brightness(b)` maps 0..1 to+ lo..1), dark glass caps it (`brightness(hi)`). CSS filter functions work per channel in gamma+ sRGB, the space `composite` blends in (measured live: predicted 153, rendered 154), so every+ squeezed channel lies in the range and the grey-endpoint argument still holds. The promise slides+ with the slider (`glassMinRatio`): `GLASS_CLEAR_RATIO` 3:1 at Clear rising to 4.5:1 at the tick,+ picked by eye over light and dark wallpapers in both themes (4.5:1 at Clear dimmed bright+ wallpapers to brown). Light glass also gets a frost floor that fades in toward the tick+ (`glassFrostFloor`, full `GLASS_LIGHT_FROST` 0.5 from the tick; without it light glass over a dark+ wallpaper read as grey mud); the text and control chrome chains carry the same floor as a static+ `--glass-frost` (light only). Terminal nodes get theirs per node as `--term-glass-backdrop`+ (`useTerminalGlass`); canvas cards (subagent, files, loop, trigger, dino) follow the slider too+ (`--glass-node-bg` at `glassSurfaceAlpha`, squeeze `--glass-node-squeeze`, both from App.tsx).+ Glass that needs no squeeze gets no filter (null; `var(--x,)` falls back to nothing), so dark+ glass at or right of the tick runs the exact chain it ran before. The kanban card modal's terminal+ has no backdrop filter of its own, so it never goes clearer than the tick+ (`useTerminalGlass(theme, true)`). Under Liquid Glass the empty-canvas hint is a text-surface pill+ (its faint ink vanished on the wallpaper). Measured with 4 terminals panning: no frame-time change.- **Glass slider + refraction** (Settings → Appearance, shown only under Liquid Glass; iOS 26'sClear ↔ Tinted). `settings.glassTint` is a slider POSITION, not an alpha (`null` = the Readabletick, read through `resolveGlassSlider`): every surface has its own readable alpha, so each maps- the position through three points — `GLASS_CLEAR_ALPHA` 0.2 at Clear (terminal nodes; chrome controls 0.35, text surfaces never below readable — see Liquid Glass chrome), its OWN computed readable+ the position through three points — `GLASS_CLEAR_ALPHA` 0.05 at Clear (terminal nodes and canvas cards; chrome controls 0.35, text surfaces never below readable — see Liquid Glass chrome), its OWN computed readablealpha at `GLASS_READABLE_TICK` (0.7), `max(readable, 0.95)` at Tinted (`glassSliderAlpha`). At thetick every surface is exactly at the alpha `glassTintAlpha`/`glassChromeAlpha` computed, and every- alpha right of it is higher — so Readable→Tinted keeps 4.5:1; left of the tick the row says the- guarantee is off. Measured: chrome dark 0.20 / 0.70 / 0.95, chrome light 0.20 / 0.745 / 0.95,- nodeterm-dark 0.20 / 0.675 / 0.95 (Clear / Readable / Tinted). App.tsx sets `--glass-t` (blur- 16→28px on chrome and × 0.85 = 13.6→23.8px on terminal nodes via `--glass-term-blur`; saturation+ alpha right of it is higher, so Readable→Tinted keeps 4.5:1 from the tint alone; left of the tick+ the backdrop squeeze carries a sliding promise (see **Backdrop squeeze**). Measured: chrome dark+ 0.05 / 0.70 / 0.95, chrome light 0.05 / 0.745 / 0.95, nodeterm-dark 0.05 / 0.675 / 0.95 (Clear /+ Readable / Tinted). App.tsx sets `--glass-t` (blur 16→28px on chrome text and controls; canvas+ cards (`--glass-blur`) and terminal nodes (`--glass-term-blur`, × 0.85) run 4px at Clear up to the+ same 24.4px at the tick, `16 + 12t − 12·max(0, 1 − t/0.7)`, picked by eye so Clear reads through; saturation`--glass-sat` 180% at Clear → 150% from the Readable tick to Tinted, text surfaces a flat 150% —round 2 N9: 1.6–2.0 turned glass olive or pink over bright wallpapers). **Refraction** is ONE shared SVG filter(`components/GlassRefraction.tsx`, `#nt-refract`: a 256² edge-lens displacement map generated once,`primitiveUnits="objectBoundingBox"` so one filter fits every element), referenced from- `--glass-blur` as `url(#nt-refract)` — no per-node filters. **It runs LAST in the chain**- (`blur() saturate() url()`) and composites over its SourceGraphic so its output is opaque: first in+ `--glass-blur` as `url(#nt-refract)` — no per-node filters. **It runs after the blur**+ (`blur() saturate() url()`; only the colour-matrix squeeze may follow it, since it moves no pixels) and composites over its SourceGraphic so its output is opaque: first inthe chain (plus an in-filter soft blur with default edgeMode) it let Chromium show a 20–40px band ofSHARP backdrop inside every glass rim at every slider value (visual QA C1). Measured on an empty`.ctx-menu` over terminal text, rim-band high-frequency energy 2.55 → 0.20 (Clear), 1.90 → 0.07diff --git a/src/renderer/App.tsx b/src/renderer/App.tsxindex d2a74ba71..a55b528cf 100644--- a/src/renderer/App.tsx+++ b/src/renderer/App.tsx@@ -25,10 +25,15 @@ import {import { useAppTheme } from './state/useAppTheme'import { installWindowActivityOnDocument } from './lib/windowActivity'import {+ glassBackdropFilter,glassChromeAlpha,glassChromeAlphas,+ glassChromeBackdropRange,glassChromeHighlights,glassControlClearAlpha,+ glassFrostFloor,+ glassMinRatio,+ glassSurfaceAlpha,parseCssColor,resolveGlassSlider} from './lib/glassContrast'@@ -124,6 +129,7 @@ export default function App() {// The readable alpha depends only on the resolved theme, and computing it is ~16k contrast// evaluations plus a style recalc; it is measured once per theme, never per slider input.const [glassChrome, setGlassChrome] = useState<{+ text: stringpanel: stringrgb?: readonly number[]readable: number | null@@ -153,6 +159,7 @@ export default function App() {// The controls' backdrop dimming (dark) / brightening (light) at Clear lives in styles.css.const dim = Number.parseFloat(getComputedStyle(root).getPropertyValue('--glass-control-dim'))setGlassChrome({+ text,panel,rgb: parseCssColor(panel)?.rgb,readable: glassChromeAlpha(text, panel, 4.5, highlights),@@ -167,15 +174,29 @@ export default function App() {if (!glassChrome) {root.style.removeProperty('--glass-chrome-bg')root.style.removeProperty('--glass-control-bg')+ root.style.removeProperty('--glass-node-bg')+ root.style.removeProperty('--glass-node-squeeze')root.style.removeProperty('--glass-t')return}- const { panel, rgb, readable, controlClear } = glassChrome+ const { text, panel, rgb, readable, controlClear } = glassChrome// An unparseable token leaves the chrome opaque (`panel` as is).const alphas = readable !== null && rgb ? glassChromeAlphas(glassSlider, readable, glassA11y, controlClear) : nullconst fill = (a: number | undefined): string => (a !== undefined && rgb ? `rgba(${rgb.join(', ')}, ${a.toFixed(3)})` : panel)root.style.setProperty('--glass-chrome-bg', fill(alphas?.text))root.style.setProperty('--glass-control-bg', fill(alphas?.control))+ // Canvas cards (subagent, files, loop, trigger, dino) follow the slider like terminal nodes, and+ // a backdrop squeeze keeps their text readable left of the tick (glassChromeBackdropRange: 3:1+ // at Clear rising to 4.5:1 at the tick, glassMinRatio).+ const nodeAlpha = readable !== null && rgb ? glassSurfaceAlpha(glassSlider, readable, glassA11y) : undefined+ root.style.setProperty('--glass-node-bg', fill(nodeAlpha))+ const range =+ nodeAlpha !== undefined+ ? glassChromeBackdropRange(text, panel, nodeAlpha, glassMinRatio(glassT), glassFrostFloor(glassT))+ : null+ const squeeze = range && glassBackdropFilter(range)+ if (squeeze) root.style.setProperty('--glass-node-squeeze', squeeze)+ else root.style.removeProperty('--glass-node-squeeze')root.style.setProperty('--glass-t', glassT.toFixed(3))}, [glassChrome, glassSlider, glassA11y, glassT])diff --git a/src/renderer/components/kanban/ModalTerminal.tsx b/src/renderer/components/kanban/ModalTerminal.tsxindex f24ee7802..eedfbd124 100644--- a/src/renderer/components/kanban/ModalTerminal.tsx+++ b/src/renderer/components/kanban/ModalTerminal.tsx@@ -223,7 +223,7 @@ export function ModalTerminal({visualRef.current = visual// Liquid Glass: the same glass as the canvas node (a second view of one session must look like// it). The DOM renderer keeps app-painted cell backgrounds opaque (see CLAUDE.md).- const { glass, vars: glassVars } = useTerminalGlass(visual.terminalTheme)+ const { glass, vars: glassVars } = useTerminalGlass(visual.terminalTheme, true)const glassRef = useRef(glass)glassRef.current = glassconst [dropping, setDropping] = useState(false)diff --git a/src/renderer/components/settings/sections/AppearanceSection.tsx b/src/renderer/components/settings/sections/AppearanceSection.tsxindex 838309f44..cec672b5f 100644--- a/src/renderer/components/settings/sections/AppearanceSection.tsx+++ b/src/renderer/components/settings/sections/AppearanceSection.tsx@@ -544,7 +544,7 @@ export function AppearanceSection({ isActive }: { isActive: boolean }): React.JS: glassA11y.moreContrast? 'Increase Contrast is on in your system settings, so glass stays at Tinted with stronger edges.': glassSlider < GLASS_READABLE_TICK- ? 'Clearer than Readable: text can fade over bright parts of the wallpaper.'+ ? 'Clearer than Readable: more of the wallpaper shows through, and terminal text stays readable.': 'Regular text keeps 4.5:1 contrast over any wallpaper.'}control={diff --git a/src/renderer/lib/glassContrast.test.ts b/src/renderer/lib/glassContrast.test.tsindex a750709e3..a4af67cbc 100644--- a/src/renderer/lib/glassContrast.test.ts+++ b/src/renderer/lib/glassContrast.test.ts@@ -34,7 +34,13 @@ import {keepGlassBlurWhileMoving,glassChipWash,GLASS_CHIP_HUES,- GLASS_CHIP_WASH_MAX+ GLASS_CHIP_WASH_MAX,+ GLASS_LIGHT_FROST,+ GLASS_CLEAR_RATIO,+ glassMinRatio,+ glassFrostFloor,+ glassChromeBackdropRange,+ glassBackdropFilter} from './glassContrast'const WHITE = [255, 255, 255] as const@@ -148,6 +154,25 @@ describe('glassChromeAlpha (Liquid Glass chrome, both app themes)', () => {}})+ it.each([+ ['dark', dark],+ ['light', light]+ ])('%s: canvas cards (subagent, files, ...) follow the slider and keep 4.5:1 at every position', (_n, theme) => {+ const textCss = resolve(theme, '--text')+ const panelCss = resolve(theme, '--panel')+ const text = parseCssColor(textCss)!+ const panel = parseCssColor(panelCss)!.rgb+ const readable = glassChromeAlpha(textCss, panelCss)!+ for (let i = 0; i <= 20; i++) {+ const a = glassSurfaceAlpha(i / 20, readable)+ const css = glassBackdropFilter(glassChromeBackdropRange(textCss, panelCss, a, glassMinRatio(i / 20), glassFrostFloor(i / 20))!)+ for (const b of RANGE_BACKDROPS) {+ expect(chromeContrast(text, panel, a, applyBackdropFilter(css, b)), `slider ${i / 20}, ${b}`).toBeGreaterThanOrEqual(glassMinRatio(i / 20) - 0.01)+ }+ }+ expect(glassChromeBackdropRange('nope', panelCss, 0.5)).toBeNull()+ })+it('parses the colour forms the tokens use', () => {expect(parseCssColor('rgba(58, 48, 38, 0.85)')).toEqual({ rgb: [58, 48, 38], alpha: 0.85 })expect(parseCssColor('#282828')).toEqual({ rgb: [40, 40, 40], alpha: 1 })@@ -256,7 +281,7 @@ describe('Glass slider (Clear ↔ Tinted)', () => {let prev = -1for (let i = 0; i <= 100; i++) {const a = glassSliderAlpha(i / 100, readable)- expect(a).toBeGreaterThanOrEqual(prev)+ expect(a).toBeGreaterThanOrEqual(prev - 1e-9)prev = a}expect(glassSliderAlpha(0, readable)).toBe(GLASS_CLEAR_ALPHA)@@ -384,3 +409,71 @@ describe('glass status chip keeps its label readable', () => {expect(body).toContain('color-mix(in srgb, currentColor var(--term-glass-chip-wash, 0%), transparent)')})})++/** What Chromium does to one backdrop pixel for `glassBackdropFilter`'s CSS (contrast then+ * brightness, per channel in gamma sRGB, clamped). Measured live: a black backdrop under+ * `contrast(0.328) brightness(1.506)` at a 0.2 nodeterm-light tint rendered 154, predicted 153. */+function applyBackdropFilter(css: string | null, [r, g, b]: readonly number[]): [number, number, number] {+ if (!css) return [r, g, b]+ const c = Number(/contrast\(([\d.]+)\)/.exec(css)?.[1] ?? 1)+ const k = Number(/brightness\(([\d.]+)\)/.exec(css)?.[1] ?? 1)+ const f = (v: number): number => Math.min(255, Math.max(0, ((v / 255 - 0.5) * c + 0.5) * k * 255))+ return [f(r), f(g), f(b)]+}++const RANGE_BACKDROPS: number[][] = []+for (let r = 0; r <= 255; r += 51)+ for (let g = 0; g <= 255; g += 51) for (let b = 0; b <= 255; b += 51) RANGE_BACKDROPS.push([r, g, b])+for (let v = 0; v <= 255; v++) RANGE_BACKDROPS.push([v, v, v])++describe('glassBackdropFilter: readable at EVERY slider position, Clear included', () => {+ const positions = Array.from({ length: 21 }, (_, i) => i / 20)+ it('the promise slides from 3:1 at Clear to 4.5:1 at the Readable tick', () => {+ expect(glassMinRatio(0)).toBe(GLASS_CLEAR_RATIO)+ expect(glassMinRatio(GLASS_READABLE_TICK)).toBe(4.5)+ expect(glassMinRatio(1)).toBe(4.5)+ expect(glassFrostFloor(0)).toBe(0)+ expect(glassFrostFloor(GLASS_READABLE_TICK)).toBe(GLASS_LIGHT_FROST)+ })++ it.each(TERMINAL_THEMES.map((t) => [t.id, t] as const))('%s', (_id, t) => {+ const fg = parseHex(t.theme.foreground!)!+ const tint = parseHex(t.theme.background!)!+ for (const pos of positions) {+ const floor = Math.min(glassMinRatio(pos), contrastRatio(fg, tint))+ const g = glassTint(t.theme, pos)!+ for (const b of RANGE_BACKDROPS) {+ const ratio = contrastRatio(fg, composite(tint, applyBackdropFilter(g.backdrop, b), g.alpha))+ expect(ratio, `slider ${pos}, backdrop ${b}`).toBeGreaterThanOrEqual(floor - 0.01)+ }+ }+ })++ it('dark themes leave the backdrop alone from the Readable tick to Tinted', () => {+ for (const t of TERMINAL_THEMES.filter((x) => x.dark)) {+ for (const pos of [GLASS_READABLE_TICK, 0.85, 1]) expect(glassTint(t.theme, pos)!.backdrop).toBeNull()+ }+ })++ it('light themes frost from the Readable tick: a black backdrop lifts to at least GLASS_LIGHT_FROST', () => {+ for (const t of TERMINAL_THEMES.filter((x) => !x.dark)) {+ for (const pos of [GLASS_READABLE_TICK, 0.85, 1]) {+ const [v] = applyBackdropFilter(glassTint(t.theme, pos)!.backdrop, [0, 0, 0])+ expect(v / 255).toBeGreaterThanOrEqual(GLASS_LIGHT_FROST)+ }+ }+ })++ it('a dark theme at Clear dims, never lifts, the backdrop', () => {+ const t = TERMINAL_THEMES.find((x) => x.id === 'nodeterm-dark')!+ const css = glassTint(t.theme, 0)!.backdrop+ expect(css).toMatch(/^brightness\(0\.\d+\)$/)+ expect(applyBackdropFilter(css, [0, 0, 0])).toEqual([0, 0, 0])+ })++ it('the chrome frost in styles.css is GLASS_LIGHT_FROST', () => {+ const css = readFileSync(join(__dirname, '../styles.css'), 'utf8')+ const m = /--glass-frost:\s*(contrast\([\d.]+\) brightness\([\d.]+\))/.exec(css)+ expect(m?.[1]).toBe(glassBackdropFilter({ lo: GLASS_LIGHT_FROST, hi: 1 }))+ })+})diff --git a/src/renderer/lib/glassContrast.ts b/src/renderer/lib/glassContrast.tsindex a79600e76..d690ddcf4 100644--- a/src/renderer/lib/glassContrast.ts+++ b/src/renderer/lib/glassContrast.ts@@ -58,13 +58,19 @@ const WHITE: Rgb = [255, 255, 255]const BLACK: Rgb = [0, 0, 0]const STEP = 0.005-/** The lowest contrast `fg` can have against the tint over ANY backdrop (see the module header). */-export function worstContrast(fg: Rgb, tint: Rgb, alpha: number): number {- const overBlack = composite(tint, BLACK, alpha)- const overWhite = composite(tint, WHITE, alpha)+/** The lowest contrast `fg` can have against the tint over ANY backdrop (see the module header).+ * `lo`/`hi` narrow the backdrop to sRGB greys lo..hi (0..1), the range `glassBackdropFilter` squeezes+ * it into; the endpoint argument holds unchanged, since every channel then lies in that range. */+export function worstContrast(fg: Rgb, tint: Rgb, alpha: number, lo = 0, hi = 1): number {+ const overLo = composite(tint, lo === 0 ? BLACK : grey(lo), alpha)+ const overHi = composite(tint, hi === 1 ? WHITE : grey(hi), alpha)const l = relativeLuminance(fg)- if (l > relativeLuminance(overBlack) && l < relativeLuminance(overWhite)) return 1- return Math.min(contrastRatio(fg, overWhite), contrastRatio(fg, overBlack))+ if (l > relativeLuminance(overLo) && l < relativeLuminance(overHi)) return 1+ return Math.min(contrastRatio(fg, overHi), contrastRatio(fg, overLo))+}++function grey(v: number): Rgb {+ return [v * 255, v * 255, v * 255]}function passes(fg: Rgb, tint: Rgb, alpha: number, minRatio: number): boolean {@@ -104,6 +110,121 @@ export function glassTintAlpha(fg: string, tint: string, minRatio = 4.5): numberreturn Math.max(GLASS_ALPHA_MIN, lowest)}+/* ------------------------------------------------------------------------------------------- *+ * Backdrop squeeze: readable at EVERY slider position.+ *+ * Left of the Readable tick the tint alone cannot hold its ratio over any backdrop (at Clear, 0.05,+ * every built-in theme measures about 1:1: dark text over a black wallpaper, light text over a+ * white one). So the backdrop filter squeezes the wallpaper into a range the tint CAN cover before+ * the tint lands on it: light glass lifts it to a floor (`contrast(c) brightness(b)` maps 0..1 to+ * lo..1), dark glass caps it (`brightness(hi)` maps 0..1 to 0..hi). Shapes and colour still show,+ * at lower contrast, which is what Clear should mean: more wallpaper, never less text. Both are+ * colour-matrix filters: per-pixel arithmetic, far cheaper than the blur they follow. Glass that+ * needs no squeeze gets no filter at all (`glassBackdropFilter` returns null). CSS filter+ * functions work per channel on gamma-encoded sRGB, the same space `composite` blends in+ * (measured: predicted 153, rendered 154).+ *+ * The promise slides with the slider (`glassMinRatio`): 3:1 at Clear, 4.5:1 from the Readable+ * tick. Picked by eye over light and dark wallpapers in both themes: 4.5:1 at Clear dimmed a+ * bright wallpaper to brown and washed a dark one to grey, and Clear stopped looking clear.+ * ------------------------------------------------------------------------------------------- */++/** From the Readable tick on, light glass lifts a black backdrop at least this far (sRGB grey,+ * 0..1): without it light glass over a dark wallpaper reads as muddy grey, not frost. Left of the+ * tick it fades out (`glassFrostFloor`) so Clear keeps the wallpaper's colour. The chrome's+ * `--glass-frost` in styles.css is this floor (pinned by glassContrast.test.ts). */+export const GLASS_LIGHT_FROST = 0.5++/** The contrast a glass surface's text keeps at Clear: WCAG's large-text minimum. */+export const GLASS_CLEAR_RATIO = 3++/** The contrast promised at slider position `t`: GLASS_CLEAR_RATIO at Clear, rising to 4.5:1 at+ * the Readable tick and holding it to Tinted. */+export function glassMinRatio(t: number): number {+ return GLASS_CLEAR_RATIO + (4.5 - GLASS_CLEAR_RATIO) * Math.min(1, t / GLASS_READABLE_TICK)+}++/** The light-glass frost floor at slider position `t`: 0 at Clear, GLASS_LIGHT_FROST from the tick. */+export function glassFrostFloor(t: number): number {+ return GLASS_LIGHT_FROST * Math.min(1, t / GLASS_READABLE_TICK)+}++/** The sRGB grey range (0..1) the backdrop is squeezed into. */+export interface BackdropRange {+ lo: number+ hi: number+}++/**+ * The gentlest squeeze that keeps `fg` at `minRatio` (or the theme's own opaque contrast, if lower)+ * on `tint`@`alpha`: light glass gets the LOWEST floor (never below `floor`), dark glass the+ * HIGHEST ceiling. Both are monotone in the bound, so a bisection finds them; at or right of the+ * Readable tick dark glass needs none (hi = 1).+ */+export function glassBackdropRange(+ fg: Rgb,+ tint: Rgb,+ alpha: number,+ minRatio = 4.5,+ floor = GLASS_LIGHT_FROST+): BackdropRange {+ const target = Math.min(minRatio, contrastRatio(fg, tint))+ const light = relativeLuminance(fg) < relativeLuminance(tint)+ const ok = (v: number): boolean =>+ (light ? worstContrast(fg, tint, alpha, v, 1) : worstContrast(fg, tint, alpha, 0, v)) >= target+ return bisectRange(light, ok, floor)+}++/**+ * `glassBackdropRange` for a chrome-coloured surface whose text is the app's translucent `--text`+ * (canvas cards: subagent, files, loop, trigger, dino). The ink moves with the backdrop, so this+ * samples like `glassChromeAlpha`, with every backdrop first squeezed into the candidate range.+ * Null when a colour cannot be parsed.+ */+export function glassChromeBackdropRange(+ text: string,+ panel: string,+ alpha: number,+ minRatio = 4.5,+ floor = GLASS_LIGHT_FROST+): BackdropRange | null {+ const t = parseCssColor(text)+ const p = parseCssColor(panel)+ if (!t || !p) return null+ const light = relativeLuminance(p.rgb) > relativeLuminance(t.rgb)+ const squeeze = (b: Rgb, v: number): Rgb =>+ (light ? b.map((c) => v * 255 + c * (1 - v)) : b.map((c) => c * v)) as unknown as Rgb+ const ok = (v: number): boolean => CHROME_BACKDROPS.every((b) => chromeContrast(t, p.rgb, alpha, squeeze(b, v)) >= minRatio)+ return bisectRange(light, ok, floor)+}++/** The shared search of both squeezes: the lowest passing floor (light, from `floor` up) or the+ * highest passing ceiling (dark, from 1 down). `ok` is monotone in the bound. */+function bisectRange(light: boolean, ok: (v: number) => boolean, floor: number): BackdropRange {+ let pass = light ? 1 : 0+ let fail = light ? floor : 1+ if (ok(fail)) return light ? { lo: fail, hi: 1 } : { lo: 0, hi: 1 }+ if (!ok(pass)) return light ? { lo: 1, hi: 1 } : { lo: 0, hi: 0 }+ for (let i = 0; i < 12; i++) {+ const mid = (pass + fail) / 2+ if (ok(mid)) pass = mid+ else fail = mid+ }+ return light ? { lo: pass, hi: 1 } : { lo: 0, hi: pass }+}++/** The CSS for a squeeze, appended to a surface's backdrop-filter; null when none is needed. Each+ * bound moves 1/255 the safe way so the 3-decimal rounding can never cost contrast. */+export function glassBackdropFilter({ lo, hi }: BackdropRange): string | null {+ if (lo > 0) {+ const l = Math.min(1, lo + 1 / 255)+ const c = (1 - l) / (1 + l)+ return `contrast(${c.toFixed(3)}) brightness(${(2 / (1 + c)).toFixed(3)})`+ }+ if (hi < 1) return `brightness(${Math.max(0, hi - 1 / 255).toFixed(3)})`+ return null+}+/* Status chips on a glass header (styles.css `.term-node__status` under Liquid Glass): the labelis the terminal foreground, and the chip behind it is a wash of the status hue. The wash movesthe surface under the text, so it gets the same treatment as the tint: the LARGEST wash (up to@@ -161,6 +282,9 @@ export interface GlassTint {/** The fill's alpha as a number — app-painted cell backgrounds follow it* (`terminal/glass-cell-backgrounds.ts`). */alpha: number+ /** The backdrop squeeze for this alpha (`glassBackdropFilter`), appended to the node's blur;+ * null when the tint alone holds the contrast. */+ backdrop: string | null}/** CSS for a theme's glass at a Glass-slider position (default: the Readable tick), or null when@@ -180,12 +304,16 @@ export function glassTint(// right of it a denser tint only leaves MORE room for the wash, so the tick's wash still passes —// one computation per theme instead of a ~21k-check cache miss per slider step.const chipWash = glassChipWash(foreground, theme.background!, readable)+ const fg = parseHex(foreground)+ const t = a11y.moreContrast ? 1 : slider+ const backdrop = fg ? glassBackdropFilter(glassBackdropRange(fg, bg, alpha, glassMinRatio(t), glassFrostFloor(t))) : nullreturn {background: `rgba(${rgb}, ${alpha.toFixed(3)})`,header: `rgba(${rgb}, ${HEADER_LAYER_ALPHA})`,chipWash: `${Math.round(chipWash * 100)}%`,foreground,- alpha+ alpha,+ backdrop}}@@ -308,8 +436,10 @@ export function glassChromeAlpha(* Left of the tick is clearer than the guarantee, and the Settings row says so.* ------------------------------------------------------------------------------------------- */-/** Tint alpha at the Clear end: never fully clear, the tint still says where a surface is. */-export const GLASS_CLEAR_ALPHA = 0.2+/** Tint alpha at the Clear end: never fully clear, the tint still says where a surface is. The+ * backdrop squeeze, not the tint, keeps the text readable there (picked by eye: 0.2 hid the+ * wallpaper's colour without buying contrast the squeeze could not give). */+export const GLASS_CLEAR_ALPHA = 0.05/** Chrome floor at Clear for the small floating CONTROLS (dock, zoom, toolbar buttons, minimap,* pills, tab bar): Apple's one published dimming figure ("consider adding a dark dimming layer of* 35% opacity", materials.md). At 0.2 their icons vanished over a bright wallpaper (visual QA H4). */diff --git a/src/renderer/lib/useTerminalGlass.ts b/src/renderer/lib/useTerminalGlass.tsindex 180761535..14e1379a8 100644--- a/src/renderer/lib/useTerminalGlass.ts+++ b/src/renderer/lib/useTerminalGlass.ts@@ -3,7 +3,7 @@ import type React from 'react'import { useSettings } from '../state/settings'import { resolveTerminalTheme } from '../terminal/themes'import { isLiquidGlass } from './appTheme'-import { glassTint, resolveGlassSlider, type GlassTint } from './glassContrast'+import { GLASS_READABLE_TICK, glassTint, resolveGlassSlider, type GlassTint } from './glassContrast'import { useGlassA11y } from './useGlassA11y'/**@@ -12,14 +12,17 @@ import { useGlassA11y } from './useGlassA11y'* tint of ITS effective theme — project override included — at the alpha that keeps its foreground* at 4.5:1 over any backdrop (glassContrast.ts). `vars` are the inline custom properties the* `.term-node--glass` / `.kanban-modal__termwrap--glass` rules read; null when not Liquid Glass.+ * `readableFloor` keeps the tint at or right of the Readable tick: for a view with no backdrop+ * filter of its own (the card modal), where the tint alone must hold the contrast.*/-export function useTerminalGlass(terminalTheme: string): {+export function useTerminalGlass(terminalTheme: string, readableFloor = false): {glass: booleantint: GlassTint | nullvars: React.CSSProperties | null} {const glass = isLiquidGlass(useSettings((s) => s.settings.appTheme))- const glassSlider = resolveGlassSlider(useSettings((s) => s.settings.glassTint))+ const slider = resolveGlassSlider(useSettings((s) => s.settings.glassTint))+ const glassSlider = readableFloor ? Math.max(slider, GLASS_READABLE_TICK) : sliderconst glassA11y = useGlassA11y()const tint = useMemo(() => (glass ? glassTint(resolveTerminalTheme(terminalTheme).theme, glassSlider, glassA11y) : null),@@ -32,7 +35,8 @@ export function useTerminalGlass(terminalTheme: string): {'--term-glass-bg': tint.background,'--term-glass-header-bg': tint.header,'--term-glass-chip-wash': tint.chipWash,- '--term-glass-fg': tint.foreground+ '--term-glass-fg': tint.foreground,+ ...(tint.backdrop && { '--term-glass-backdrop': tint.backdrop })} as React.CSSProperties): null,[tint]diff --git a/src/renderer/styles.css b/src/renderer/styles.cssindex 657eb3e36..e62ea3550 100644--- a/src/renderer/styles.css+++ b/src/renderer/styles.css@@ -1631,8 +1631,8 @@ body,way, the scripted gesture 36 s vs 28 s); without it, 0. camera-moving.test.ts pins its absence. *//* The blur is re-rasterised for every glass node on every frame of a pan/zoom (their backdropmoves under them). With Keep blur while moving OFF (settings.glassBlurWhileMoving), Canvas marks- the flow wrapper while the camera moves; the tint stays, and the tint alone is what keeps text at- 4.5:1, so only the frosting pauses. With it on (the default) the class is never set. */+ the flow wrapper while the camera moves; the tint stays, plus left of the Readable tick the+ backdrop squeeze (Liquid Glass block), so text keeps 4.5:1 and only the frosting pauses. With it on (the default) the class is never set. */.canvas-moving .term-node.term-node--glass {-webkit-backdrop-filter: none;backdrop-filter: none;@@ -16925,18 +16925,25 @@ body.focus-mode .dock:hover {HIG liquid-glass › Tauri and Electron suggests about 1.2–1.5). */--glass-sat: calc(150% + 30% * max(0, 1 - var(--glass-t) / 0.7));--glass-refract: url(#nt-refract);- --glass-blur: blur(calc(16px + 12px * var(--glass-t))) saturate(var(--glass-sat))- var(--glass-refract);+ /* `--glass-frost` (light only, below) is the backdrop squeeze of lib/glassContrast.ts: last in+ the text and control chains, a colour matrix that moves no pixels. Unset in dark. */+ /* Canvas cards and terminal nodes frost far less toward Clear: 4px at Clear (picked by eye, the+ wallpaper reads through), the same 24.4px as before at the Readable tick, 28px at Tinted. No+ `--glass-frost` here: the cards' own squeeze (`--glass-node-squeeze`) already carries the frost+ floor for their slider position, and stacking both washed them out twice. */+ --glass-blur: blur(calc(16px + 12px * var(--glass-t) - 12px * max(0, 1 - var(--glass-t) / 0.7)))+ saturate(var(--glass-sat)) var(--glass-refract);/* Small controls left of the tick: the backdrop under them is DIMMED (dark theme) or brightened(light theme) as the fill thins, toward Apple's "dark dimming layer" for bright content(materials.md). 1 at the tick and right of it; `--glass-control-dim` at Clear. The fill alone(0.35) left the tab label at 1.98:1 over the Sunrise gradient. It moves backdrop pixels only. */--glass-control-dim: 0.7;--glass-control-blur: blur(calc(16px + 12px * var(--glass-t))) saturate(var(--glass-sat))- brightness(calc(1 - (1 - var(--glass-control-dim)) * max(0, 1 - var(--glass-t) / 0.7))) var(--glass-refract);+ brightness(calc(1 - (1 - var(--glass-control-dim)) * max(0, 1 - var(--glass-t) / 0.7))) var(--glass-refract)+ var(--glass-frost,);/* Text surfaces never frost less than at the Readable tick (0.7), whatever the slider says. */--glass-text-blur: blur(calc(16px + 12px * max(var(--glass-t), 0.7)))- saturate(150%) var(--glass-refract);+ saturate(150%) var(--glass-refract) var(--glass-frost,);/* Terminal nodes frost 15% less than the chrome (the user asked for less blur under the terminalwindows): same curve, radius × 0.85, same saturation and refraction. They also FLATTEN thebackdrop's luminance (HIG: regular glass "blurs and adjusts the luminosity"): a blurred photo@@ -16945,7 +16952,7 @@ body.focus-mode .dock:hover {keeps the photo (1), Readable 0.3, Tinted 0 (flat — the tint is 0.95 there anyway). Measuredat Readable, empty glass over the lake photo's snow/water edge: brightness swing 2.2:1 → 1.28:1(0.51 still left 1.53:1). */- --glass-term-blur: blur(calc((16px + 12px * var(--glass-t)) * 0.85))+ --glass-term-blur: blur(calc((16px + 12px * var(--glass-t) - 12px * max(0, 1 - var(--glass-t) / 0.7)) * 0.85))saturate(var(--glass-sat)) contrast(calc(1 - var(--glass-t))) var(--glass-refract);}@@ -16981,7 +16988,8 @@ body.focus-mode .dock:hover {.pubdlg,.consent-card,.github-issue-modal,- .mlaunch+ .mlaunch,+ .empty-canvas-hint) {background: var(--glass-chrome-bg) !important;-webkit-backdrop-filter: var(--glass-text-blur);@@ -17005,7 +17013,23 @@ body.focus-mode .dock:hover {-webkit-backdrop-filter: var(--glass-control-blur);backdrop-filter: var(--glass-control-blur);}+/* The empty-canvas hint sits straight on the wallpaper, where its faint ink vanished (dark text on a+ dark wallpaper in light glass). Under glass it is a small text-surface pill instead. */+:root[data-nt-glass='on'] .empty-canvas-hint {+ inset: 50% auto auto 50%;+ transform: translate(-50%, -50%);+ padding: 14px 20px;+ border: 1px solid var(--glass-edge);+ border-radius: 14px;+ color: var(--text);+}+:root[data-nt-glass='on'] .empty-canvas-hint .kbd {+ opacity: 1;+}:root[data-nt-glass='on'][data-theme='light'] {+ /* Lifts a black backdrop to grey 0.5 (GLASS_LIGHT_FROST): light glass over a dark wallpaper reads+ as frost, not mud. Only lifts, so dark ink on it only gains contrast. */+ --glass-frost: contrast(0.330) brightness(1.504);--glass-control-dim: 1.3;--muted: rgba(var(--tint-rgb), 0.8);--glass-placeholder: rgba(var(--tint-rgb), 0.85);@@ -17556,13 +17580,14 @@ body.focus-mode .dock:hover {}/* Every node kind. Terminal nodes keep their own theme-derived tint (.term-node--glass, above);- the others take the chrome fill here. Bodies+ the others take `--glass-node-bg`, the chrome colour at the SLIDER's alpha (App.tsx), with+ `--glass-node-squeeze` holding their text at 4.5:1 left of the Readable tick. Bodiesthat are another renderer's surface — Monaco, a <webview>, a <video> — stay opaque: they painttheir own background. Sticky notes keep their colour: the colour IS the note. */:root[data-nt-glass='on'] :is(.files-node, .loop-node, .subagent-node, .trigger-node, .dino-node) {- background: var(--glass-chrome-bg);- -webkit-backdrop-filter: var(--glass-blur);- backdrop-filter: var(--glass-blur);+ background: var(--glass-node-bg);+ -webkit-backdrop-filter: var(--glass-blur) var(--glass-node-squeeze,);+ backdrop-filter: var(--glass-blur) var(--glass-node-squeeze,);}:root[data-nt-glass='on'].canvas-moving@@ -17570,13 +17595,40 @@ body.focus-mode .dock:hover {-webkit-backdrop-filter: none;backdrop-filter: none;}+/* ...but every node keeps its squeeze: left of the Readable tick it, not the tint, holds the text+ at 4.5:1. A colour matrix with no blur, so the pan still sheds the expensive part. */+:root[data-nt-glass='on'] .canvas-moving .term-node {+ -webkit-backdrop-filter: var(--term-glass-backdrop, none);+ backdrop-filter: var(--term-glass-backdrop, none);+}+:root[data-nt-glass='on'] .canvas-moving :is(.files-node, .loop-node, .subagent-node, .trigger-node, .dino-node) {+ -webkit-backdrop-filter: var(--glass-node-squeeze, none);+ backdrop-filter: var(--glass-node-squeeze, none);+}+/* Subagent cards: no clay stripe (Liquid Glass drops window accents, the dot keeps the state), and+ the transcript is ink on the card's glass instead of a black slab with hard-coded grey text. */+:root[data-nt-glass='on'] .subagent-node {+ border-color: var(--glass-edge);+ border-left-width: 1px;+}+:root[data-nt-glass='on'] .subagent-node.working .subagent-node__dot {+ background: var(--state-working);+}+:root[data-nt-glass='on'] .subagent-node__term {+ background: transparent;+ border-color: var(--glass-edge);+ color: var(--text);+}/* No per-node accent colour on a window (the sessions list and the kanban board keep them). Thetop border and the colour dot are INLINE styles from `data.color`, hence !important. The dotstays as a neutral ring: it is also the button that opens the colour picker. */:root[data-nt-glass='on'] .term-node {- -webkit-backdrop-filter: var(--glass-term-blur);- backdrop-filter: var(--glass-term-blur);+ /* `--term-glass-backdrop` is this node's squeeze (useTerminalGlass): what keeps its text at 4.5:1+ left of the Readable tick. Unset when the tint alone suffices. Under Reduce Transparency the+ chain is `none brightness(...)`, which is invalid and so computes to none, as before. */+ -webkit-backdrop-filter: var(--glass-term-blur) var(--term-glass-backdrop,);+ backdrop-filter: var(--glass-term-blur) var(--term-glass-backdrop,);border-color: var(--glass-edge);border-top-width: 1px;border-top-color: var(--glass-edge) !important;@@ -17703,7 +17755,8 @@ body.focus-mode .dock:hover {}/* The card modal's terminal: the same glass as a terminal node (ModalTerminal sets the`--term-glass-*` tint inline). The modal itself is text-surface glass (listed above), so the- tint needs no blur of its own; the tint alone carries its foreground's 4.5:1. */+ tint needs no blur of its own. It never goes clearer than the Readable tick+ (`useTerminalGlass(theme, true)`), so the tint alone carries its foreground's 4.5:1. *//* The card modal's comments & activity panel hard-codes 35–55% ink for its title, times and events(3.1–3.6:1 on glass, visual QA M3): secondary label on glass, like the rest of the look. */:root[data-nt-glass='on'] :is(.board-log__title, .board-log__hint, .board-log__time, .board-log__event-body) {diff --git a/src/renderer/styles.glass-traps.test.ts b/src/renderer/styles.glass-traps.test.tsindex 5e92ac0b3..954e8e028 100644--- a/src/renderer/styles.glass-traps.test.ts+++ b/src/renderer/styles.glass-traps.test.ts@@ -31,7 +31,7 @@ import { describe, expect, it } from 'vitest'* The live half — backdrop roots, which CSS alone cannot see, at rest and mid-animation — is* `scripts/glass-trap-probe.mjs` (see CLAUDE.md, Liquid Glass chrome).*/-const FILL = /var\(--(glass-chrome-bg|glass-control-bg|term-glass-bg|term-glass-header-bg)\)/+const FILL = /var\(--(glass-chrome-bg|glass-control-bg|glass-node-bg|term-glass-bg|term-glass-header-bg)\)/const PAINT = /(?:^|;)\s*(background(?:-color|-image)?|--[\w-]+)\s*:([^;]*)/gconst GATE = /^:root\[data-nt-glass='on'\](?:\[[^\]]*\])*\s*/diff --git a/src/renderer/styles.palette.test.ts b/src/renderer/styles.palette.test.tsindex 63012a855..b2ad76031 100644--- a/src/renderer/styles.palette.test.ts+++ b/src/renderer/styles.palette.test.ts@@ -247,8 +247,10 @@ describe('needs-you under Liquid Glass is an inner light', () => {describe('terminal glass blur', () => {it('terminal nodes frost 15% less than the chrome, and drop it under Reduce Transparency', () => {const glass = blocks(":root[data-nt-glass='on']")- expect(glass.get('--glass-blur')).toContain('blur(calc(16px + 12px * var(--glass-t)))')- expect(glass.get('--glass-term-blur')).toContain('blur(calc((16px + 12px * var(--glass-t)) * 0.85))')+ // Both curves drop to 4px (x0.85) at Clear and meet the old 16 + 12t from the Readable tick on.+ const curve = '16px + 12px * var(--glass-t) - 12px * max(0, 1 - var(--glass-t) / 0.7)'+ expect(glass.get('--glass-blur')).toContain(`blur(calc(${curve}))`)+ expect(glass.get('--glass-term-blur')).toContain(`blur(calc((${curve}) * 0.85))`)const rule = CSS.slice(CSS.indexOf(":root[data-nt-glass='on'] .term-node {\n"))expect(rule.slice(0, rule.indexOf('}'))).toContain('backdrop-filter: var(--glass-term-blur)')const reduce = CSS.slice(CSS.indexOf('@media (prefers-reduced-transparency: reduce) {'))@@ -261,7 +263,9 @@ describe('terminal glass blur', () => {it.each(['--glass-blur', '--glass-term-blur'])('%s refracts last, after the blur', (name) => {const chain = blocks(":root[data-nt-glass='on']").get(name)!.replace(/\s+/g, ' ')expect(chain.indexOf('blur(')).toBe(0)- expect(chain.trim().endsWith('var(--glass-refract)')).toBe(true)+ // Only the colour-matrix squeeze may follow it: it moves no pixels, so it cannot bring back the+ // sharp rim band a reference filter ahead of blur() caused (visual QA C1).+ expect(chain.trim().replace(/ var\(--glass-frost,\)$/, '').endsWith('var(--glass-refract)')).toBe(true)})it('terminal glass flattens the backdrop luminance toward Tinted, and not at Clear', () => {diff --git a/src/renderer/styles.theme.test.ts b/src/renderer/styles.theme.test.tsindex d149ac61f..895a87c7b 100644--- a/src/renderer/styles.theme.test.ts+++ b/src/renderer/styles.theme.test.ts@@ -110,6 +110,9 @@ describe('every CSS variable resolves', () => {'--term-glass-header-bg','--term-glass-fg','--term-glass-chip-wash', // TerminalNode, status-chip wash per theme (glassChipWash)+ '--term-glass-backdrop', // TerminalNode, backdrop squeeze per node (glassBackdropFilter)+ '--glass-node-bg', // App.tsx, canvas-card fill at the slider's alpha (glassSurfaceAlpha)+ '--glass-node-squeeze', // App.tsx, canvas-card backdrop squeeze (glassChromeBackdropRange)'--glass-chrome-bg', // App.tsx, Liquid Glass chrome fill (lib/glassContrast.ts glassChromeAlpha)'--glass-control-bg', // App.tsx, Liquid Glass small-control fill (glassChromeAlphas)'--glass-fill', // GlassSlider, the slider value (fills the track)