Skip to content

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.

fix(glass): readable alpha holds on highlighted rows; controls keep 3:1 at Clear (visual QA N2, N5, N6, N12, H4)

iceclatterWTd24bbe8e72ce
diff --git a/src/renderer/App.tsx b/src/renderer/App.tsx
index a74667d31..7d72ee81e 100644
--- a/src/renderer/App.tsx
+++ b/src/renderer/App.tsx
@@ -19,7 +19,14 @@ import { resolveUiScale } from '../shared/ui-scale'
import { resolveTabBarHeight } from '../shared/window-chrome-metrics'
import { useAppTheme } from './state/useAppTheme'
import { installWindowActivityOnDocument } from './lib/windowActivity'
-import { glassChromeAlpha, glassChromeAlphas, parseCssColor, resolveGlassSlider } from './lib/glassContrast'
+import {
+ glassChromeAlpha,
+ glassChromeAlphas,
+ glassChromeHighlights,
+ glassControlClearAlpha,
+ parseCssColor,
+ resolveGlassSlider
+} from './lib/glassContrast'
import { useGlassA11y } from './lib/useGlassA11y'
import { GlassRefraction } from './components/GlassRefraction'
import { isLiquidGlass } from './lib/appTheme'
@@ -87,6 +94,8 @@ export default function App() {
// stays the one source of truth; declared after the data-theme effect, so it reads the tokens
// of the theme that effect just applied. An unparseable token leaves the chrome opaque.
const liquidGlass = isLiquidGlass(useSettings((s) => s.settings.appTheme))
+ // The accent is one of the highlight washes the readable alpha is solved for.
+ const accent = useSettings((s) => s.settings.accent)
// The Glass slider moves every surface between Clear and Tinted through its own readable alpha
// (glassSliderAlpha); `--glass-t` scales the blur in CSS.
const glassSlider = resolveGlassSlider(useSettings((s) => s.settings.glassTint))
@@ -100,6 +109,7 @@ export default function App() {
panel: string
rgb?: readonly number[]
readable: number | null
+ controlClear: number
} | null>(null)
useLayoutEffect(() => {
const root = document.documentElement
@@ -114,9 +124,23 @@ export default function App() {
const css = getComputedStyle(root)
const text = css.getPropertyValue('--text').trim()
const panel = css.getPropertyValue('--panel').trim()
- setGlassChrome({ panel, rgb: parseCssColor(panel)?.rgb, readable: glassChromeAlpha(text, panel) })
+ // The fill must also carry the highlighted rows and the active tab (their washes stack on it).
+ const highlights = glassChromeHighlights(
+ css.getPropertyValue('--text-strong').trim(),
+ css.getPropertyValue('--tint-rgb').trim(),
+ // The setting, not the `--accent` property: Canvas writes that in a later effect.
+ accent
+ )
root.dataset.ntGlass = 'on'
- }, [liquidGlass, appTheme])
+ // The controls' backdrop dimming (dark) / brightening (light) at Clear lives in styles.css.
+ const dim = Number.parseFloat(getComputedStyle(root).getPropertyValue('--glass-control-dim'))
+ setGlassChrome({
+ panel,
+ rgb: parseCssColor(panel)?.rgb,
+ readable: glassChromeAlpha(text, panel, 4.5, highlights),
+ controlClear: glassControlClearAlpha(text, panel, dim)
+ })
+ }, [liquidGlass, appTheme, accent])
// The slider (and the accessibility overrides) only ever set custom properties. Two fills:
// `--glass-chrome-bg` for text surfaces (never below the readable alpha) and `--glass-control-bg`
// for the small floating controls (follow the slider to a 0.35 floor) — glassChromeAlphas.
@@ -128,9 +152,9 @@ export default function App() {
root.style.removeProperty('--glass-t')
return
}
- const { panel, rgb, readable } = glassChrome
+ const { panel, rgb, readable, controlClear } = glassChrome
// An unparseable token leaves the chrome opaque (`panel` as is).
- const alphas = readable !== null && rgb ? glassChromeAlphas(glassSlider, readable, glassA11y) : null
+ const alphas = readable !== null && rgb ? glassChromeAlphas(glassSlider, readable, glassA11y, controlClear) : null
const 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))
diff --git a/src/renderer/lib/glassContrast.test.ts b/src/renderer/lib/glassContrast.test.ts
index e5310cb08..37a56071f 100644
--- a/src/renderer/lib/glassContrast.test.ts
+++ b/src/renderer/lib/glassContrast.test.ts
@@ -10,6 +10,11 @@ import {
glassTintAlpha,
chromeContrast,
glassChromeAlpha,
+ glassChromeHighlights,
+ glassControlClearAlpha,
+ chromeHighlightContrast,
+ GLASS_LIFT_ALPHA,
+ GLASS_SELECT_MIX,
parseCssColor,
parseHex,
worstContrast,
@@ -150,6 +155,70 @@ describe('glassChromeAlpha (Liquid Glass chrome, both app themes)', () => {
})
})
+describe('highlights, placeholders and small controls on the chrome fill (visual QA round 2)', () => {
+ const CSS = readFileSync(join(__dirname, '../styles.css'), 'utf8').replace(/\r\n/g, '\n')
+ const block = (selector: string): string => {
+ const start = CSS.indexOf(`\n${selector} {\n`)
+ return CSS.slice(start, CSS.indexOf('\n}', start + 1))
+ }
+ const token = (body: string, name: string): string | undefined =>
+ new RegExp(`\\n\\s*${name}:\\s*([^;]+);`).exec(body)?.[1].trim()
+ const dark = block(':root')
+ const light = block(":root[data-theme='light']")
+ const glass = block(":root[data-nt-glass='on']")
+ const glassLight = block(":root[data-nt-glass='on'][data-theme='light']")
+ const tint = (t: string): string => token(t, '--tint-rgb') ?? token(dark, '--tint-rgb')!
+ const resolve = (t: string, name: string): string =>
+ (token(t, name) ?? token(dark, name)!).replace('var(--tint-rgb)', tint(t))
+ const ACCENT = '#0a84ff' // settings default (shared/types.ts)
+ const themes = [
+ ['dark', dark, glass],
+ ['light', light, glassLight]
+ ] as const
+
+ it('the wash constants are the stylesheet\'s', () => {
+ expect(token(glass, '--glass-lift')).toBe(`rgba(var(--tint-rgb), ${GLASS_LIFT_ALPHA})`)
+ expect(token(glass, '--glass-select')).toBe(`color-mix(in srgb, var(--accent) ${GLASS_SELECT_MIX * 100}%, transparent)`)
+ })
+
+ it.each(themes)('%s: the active tab / hovered / selected rows keep 4.5:1 at the readable alpha', (_n, t) => {
+ const hs = glassChromeHighlights(resolve(t, '--text-strong'), tint(t), ACCENT)
+ expect(hs).toHaveLength(2)
+ const a = glassChromeAlpha(resolve(t, '--text'), resolve(t, '--panel'), 4.5, hs)!
+ const plain = glassChromeAlpha(resolve(t, '--text'), resolve(t, '--panel'))!
+ expect(a).toBeGreaterThanOrEqual(plain)
+ expect(a).toBeLessThan(0.8) // still glass, not a slab
+ const panel = parseCssColor(resolve(t, '--panel'))!.rgb
+ for (const h of hs) {
+ const ink = parseCssColor(h.ink)!
+ const wash = parseCssColor(h.wash)!
+ for (let v = 0; v <= 255; v += 3) {
+ expect(chromeHighlightContrast(ink, wash, panel, a, [v, v, v])).toBeGreaterThanOrEqual(4.5)
+ }
+ }
+ })
+
+ it.each(themes)('%s: placeholders keep 4.5:1 on the plain fill', (_n, t, g) => {
+ const a = glassChromeAlpha(resolve(t, '--text'), resolve(t, '--panel'), 4.5, glassChromeHighlights(resolve(t, '--text-strong'), tint(t), ACCENT))!
+ const ph = parseCssColor((token(g, '--glass-placeholder') ?? token(glass, '--glass-placeholder')!).replace('var(--tint-rgb)', tint(t)))!
+ const panel = parseCssColor(resolve(t, '--panel'))!.rgb
+ for (let v = 0; v <= 255; v += 3) expect(chromeContrast(ph, panel, a, [v, v, v])).toBeGreaterThanOrEqual(4.5)
+ })
+
+ it.each(themes)('%s: small controls keep 3:1 icons at Clear, never below the 0.35 floor', (_n, t, g) => {
+ const dim = Number(token(g, '--glass-control-dim') ?? token(glass, '--glass-control-dim'))
+ const a = glassControlClearAlpha(resolve(t, '--text'), resolve(t, '--panel'), dim)
+ expect(a).toBeGreaterThanOrEqual(GLASS_CONTROL_CLEAR_ALPHA)
+ const text = parseCssColor(resolve(t, '--text'))!
+ const panel = parseCssColor(resolve(t, '--panel'))!.rgb
+ for (let v = 0; v <= 255; v += 3) {
+ const b = Math.min(255, v * dim)
+ expect(chromeContrast(text, panel, a, [b, b, b])).toBeGreaterThanOrEqual(3)
+ }
+ expect(glassChromeAlphas(0, 0.74, undefined, a).control).toBeCloseTo(Math.min(a, 0.74), 10)
+ })
+})
+
describe('Glass slider (Clear ↔ Tinted)', () => {
const css = readFileSync(join(__dirname, '..', 'styles.css'), 'utf8').replace(/\r\n/g, '\n')
const body = (sel: string): string => {
diff --git a/src/renderer/lib/glassContrast.ts b/src/renderer/lib/glassContrast.ts
index 2ede139de..a79600e76 100644
--- a/src/renderer/lib/glassContrast.ts
+++ b/src/renderer/lib/glassContrast.ts
@@ -229,19 +229,67 @@ export function chromeContrast(
return contrastRatio(composite(text.rgb, surface, text.alpha), surface)
}
+/** The highlight washes on glass rows (styles.css `--glass-lift` = theme ink at this alpha,
+ * `--glass-select` = the accent mixed at this share). Pinned to the stylesheet by
+ * glassContrast.test.ts, so the two cannot drift apart. */
+export const GLASS_LIFT_ALPHA = 0.14
+export const GLASS_SELECT_MIX = 0.3
+
+/** A highlighted state on a chrome surface: `wash` composited over the fill, `ink` on top. */
+export interface ChromeHighlight {
+ ink: string
+ wash: string
+}
+
+/** Contrast of `text` on a highlight `wash` over `panel`@`alpha` over one backdrop pixel. */
+export function chromeHighlightContrast(
+ text: { rgb: Rgb; alpha: number },
+ wash: { rgb: Rgb; alpha: number },
+ panel: Rgb,
+ alpha: number,
+ backdrop: Rgb
+): number {
+ return chromeContrast(text, wash.rgb, wash.alpha, composite(panel, backdrop, alpha))
+}
+
+/** The highlighted states every glass chrome surface carries, from the resolved tokens: the ink
+ * lift (hover, active tab) and the accent selection, both with `--text-strong` labels (styles.css
+ * sets that ink on them under glass). An unparseable accent drops only the selection check. */
+export function glassChromeHighlights(textStrong: string, tintRgb: string, accent: string): ChromeHighlight[] {
+ const out: ChromeHighlight[] = [{ ink: textStrong, wash: `rgba(${tintRgb}, ${GLASS_LIFT_ALPHA})` }]
+ const a = parseCssColor(accent)
+ if (a) out.push({ ink: textStrong, wash: `rgba(${a.rgb.join(', ')}, ${GLASS_SELECT_MIX})` })
+ return out
+}
+
/**
* The smallest alpha (floored at 0.55) for a chrome surface of colour `panel` that keeps `text`
* at `minRatio` over every sampled backdrop; 1 when even opaque does not reach it; null when a
* colour cannot be parsed (the caller then leaves the chrome opaque).
+ *
+ * `highlights` are the washes a row or tab lays over the same fill (hover lift, active tab,
+ * selected row) with the ink they carry: the fill must hold `minRatio` for EVERY one of them too.
+ * A lift of the theme's own ink moves the surface toward the text, so without this the plain fill
+ * passed and the active tab measured 3.9:1 (visual QA round 2, N2).
*/
-export function glassChromeAlpha(text: string, panel: string, minRatio = 4.5): number | null {
+export function glassChromeAlpha(
+ text: string,
+ panel: string,
+ minRatio = 4.5,
+ highlights: readonly ChromeHighlight[] = []
+): number | null {
const t = parseCssColor(text)
const p = parseCssColor(panel)
if (!t || !p) return null
+ const hs = highlights.map((h) => ({ ink: parseCssColor(h.ink), wash: parseCssColor(h.wash) }))
+ if (hs.some((h) => !h.ink || !h.wash)) return null
+ const holds = (a: number, b: Rgb): boolean =>
+ chromeContrast(t, p.rgb, a, b) >= minRatio &&
+ hs.every((h) => chromeHighlightContrast(h.ink!, h.wash!, p.rgb, a, b) >= minRatio)
let lowest = Infinity
for (let i = Math.round(1 / STEP); i >= 0; i--) {
const a = i * STEP
- if (!CHROME_BACKDROPS.every((b) => chromeContrast(t, p.rgb, a, b) >= minRatio)) break
+ if (!CHROME_BACKDROPS.every((b) => holds(a, b))) break
lowest = a
}
if (lowest === Infinity) return 1
@@ -328,12 +376,32 @@ export function glassSurfaceAlpha(
export function glassChromeAlphas(
t: number,
readable: number,
- a11y: GlassA11y = NO_GLASS_A11Y
+ a11y: GlassA11y = NO_GLASS_A11Y,
+ controlClear = GLASS_CONTROL_CLEAR_ALPHA
): { text: number; control: number } {
return {
text: glassSurfaceAlpha(Math.max(t, GLASS_READABLE_TICK), readable, a11y),
- control: glassSurfaceAlpha(t, readable, a11y, GLASS_CONTROL_CLEAR_ALPHA)
+ control: glassSurfaceAlpha(t, readable, a11y, Math.min(controlClear, readable))
+ }
+}
+
+/**
+ * The CONTROLS' alpha at Clear: at least `GLASS_CONTROL_CLEAR_ALPHA`, and enough that `text` (their
+ * icons) keeps 3:1 — WCAG's non-text minimum — over every sampled backdrop once the control blur's
+ * `brightness(dim)` has scaled it (styles.css `--glass-control-dim`: 0.7 dark, 1.3 light). The
+ * dark theme's dimming carries it at 0.35; brightening cannot lift near-black water, so light glass
+ * needs a denser floor (visual QA round 2, H4: zoom − measured 2.1:1 in light at Clear).
+ */
+export function glassControlClearAlpha(text: string, panel: string, dim: number): number {
+ const t = parseCssColor(text)
+ const p = parseCssColor(panel)
+ if (!t || !p || !Number.isFinite(dim)) return GLASS_CONTROL_CLEAR_ALPHA
+ const dimmed = CHROME_BACKDROPS.map((b) => b.map((c) => Math.min(255, c * dim)) as unknown as Rgb)
+ for (let i = Math.round(GLASS_CONTROL_CLEAR_ALPHA / STEP); i <= Math.round(1 / STEP); i++) {
+ const a = i * STEP
+ if (dimmed.every((b) => chromeContrast(t, p.rgb, a, b) >= 3)) return a
}
+ return 1
}
/** Magnetic detent, like a macOS slider's tick marks: a drag within this of the tick lands on it. */
diff --git a/src/renderer/styles.css b/src/renderer/styles.css
index a9379b771..bf8b164ac 100644
--- a/src/renderer/styles.css
+++ b/src/renderer/styles.css
@@ -13570,6 +13570,7 @@ body.focus-mode .dock:hover {
--glass-lift-hover: rgba(var(--tint-rgb), 0.1);
--glass-lift: rgba(var(--tint-rgb), 0.14);
--glass-select: color-mix(in srgb, var(--accent) 30%, transparent);
+ --glass-placeholder: rgba(var(--tint-rgb), 0.78);
/* The Glass slider (App.tsx sets the live values inline; these are the Readable-tick defaults):
`--glass-t` 0 = Clear … 1 = Tinted.
Clearer glass blurs a little less and saturates a little more, and refracts at its rim
@@ -13656,6 +13657,7 @@ body.focus-mode .dock:hover {
:root[data-nt-glass='on'][data-theme='light'] {
--glass-control-dim: 1.3;
--muted: rgba(var(--tint-rgb), 0.8);
+ --glass-placeholder: rgba(var(--tint-rgb), 0.86);
}
/* The pills' own hovers are opaque literals (`rgba(44,44,46,.95)` is a dark-theme colour): on
glass a hover is a neutral lift over the same fill. */
@@ -13770,9 +13772,17 @@ body.focus-mode .dock:hover {
}
/* Row highlights: every hover/selected row that painted `--panel-header` (= the fill again). */
+/* Every highlighted state carries `--text-strong` ink: App.tsx solves the fill's readable alpha for
+ these washes WITH that ink (`glassChromeHighlights`), so a highlighted row keeps 4.5:1 exactly
+ like a plain one (visual QA round 2, N2: the active tab measured 3.9:1). */
:root[data-nt-glass='on'] :is(.ctx-item, .tab-menu button, .dock-menu button, .dock-menu__sub button):hover:not(:disabled),
:root[data-nt-glass='on'] :is(.dock-menu__row:hover, .dock-menu__row:focus-within, .settings-nav-row:hover) {
background: var(--glass-lift);
+ color: var(--text-strong);
+}
+/* Its two icons read at 3:1 on the lift (visual QA round 2, N2: 2.0:1 at the default 0.45). */
+:root[data-nt-glass='on'] .tab.active :is(.tab__board-toggle, .tab__caret) {
+ opacity: 0.8;
}
:root[data-nt-glass='on'] .settings-nav-row {
background: transparent;
@@ -13867,6 +13877,37 @@ body.focus-mode .dock:hover {
}
:root[data-nt-glass='on'] .kanban-card:hover {
background: var(--glass-lift);
+ color: var(--text-strong);
+}
+/* Hovers that painted `--panel-header` (= the fill again, a dark slab on glass — N5). */
+:root[data-nt-glass='on'] :is(.dock-btn:not(.dock-add):hover:not(:disabled), .dock-zoom:hover, .ss-row:hover) {
+ background: var(--glass-lift-hover);
+}
+:root[data-nt-glass='on'] .dock-zoom.active {
+ background: var(--glass-lift);
+ color: var(--text-strong);
+}
+/* The default Button is `bg-panel-header`, the fill stacked on its own panel ("Set default" read as
+ a dark slab, N5): a neutral lift instead; its own hover (`bg-fill-weak`) still applies. */
+:root[data-nt-glass='on'] button.bg-panel-header:not(:hover) {
+ background-color: var(--glass-lift-hover);
+}
+/* Segmented controls: the selected segment is a neutral lifted thumb, as in Apple's segmented
+ control, so the one filled accent per view stays the primary action (N12: Settings → Agents
+ showed seven accent fills). */
+:root[data-nt-glass='on'] .seg-pill-opt {
+ color: var(--muted);
+}
+:root[data-nt-glass='on'] .seg-pill-opt.active {
+ background: var(--glass-lift);
+ color: var(--text-strong);
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
+}
+/* Placeholders were a hard-coded #757575 in both themes (2.5–3.5:1, N6). On glass they keep 4.5:1
+ on the text-surface fill: `--glass-placeholder` is pinned by glassContrast.test.ts. */
+/* Sticky notes keep theirs: the note's own colour is the surface there, not glass. */
+:root[data-nt-glass='on'] :not(.sticky-node__body)::placeholder {
+ color: var(--glass-placeholder);
}
:root[data-nt-glass='on'] .kanban-col--drop {
border-color: var(--text);
@@ -13879,6 +13920,7 @@ body.focus-mode .dock:hover {
:root[data-nt-glass='on'] .kanban-card--drop-after::after {
background: var(--text);
box-shadow: none;
+ color: var(--text-strong);
}
:root[data-nt-glass='on'] .kanban-badge--running {
color: var(--state-working);