From c9ad053aac8f89ed727ac82a6f3c9201f2c37b56 Mon Sep 17 00:00:00 2001 From: Valerii Kovalskii Date: Thu, 30 Jul 2026 14:58:59 +0300 Subject: [PATCH] fix(terminal): dimmed text on a filled background no longer renders invisible MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Claude Code (and other TUIs) draw some rows as *dimmed* text on a filled background — e.g. the grey 'message above' bars. In a codbash pane those bars came out as empty grey strips with no text at all, while the same output stayed legible in iTerm. Cause: xterm's minimumContrastRatio defaults to 1, which disables all contrast adjustment — and the dim path is gated behind it (xterm.js: 'minimumContrastRatio||(0…)' and 'minimumContrastRatio/(s.isDim(…)'). The WebGL renderer applies dim by cutting the foreground alpha, so with no adjustment dim-on-background washes out to invisible. Both the webgl and canvas addons honor the option. Fix: set minimumContrastRatio to 4.5 (WCAG AA). xterm only nudges a foreground when it falls below the ratio, so normal colors are untouched. Co-Authored-By: Claude Opus 5 (1M context) --- src/frontend/workspace.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/frontend/workspace.js b/src/frontend/workspace.js index a6a1c93..2446d6d 100644 --- a/src/frontend/workspace.js +++ b/src/frontend/workspace.js @@ -552,7 +552,16 @@ function _wsConnectPane(pane) { var term = new Terminal({ cursorBlink: _tp.cursorBlink, cursorStyle: _tp.cursorStyle, fontSize: _tp.fontSize, fontFamily: _tp.fontFamily, - theme: _wsTermTheme(), scrollback: 5000, allowProposedApi: true + theme: _wsTermTheme(), scrollback: 5000, allowProposedApi: true, + // Guarantee readable text against whatever background a TUI paints. + // Without this (xterm's default is 1 = no adjustment) *dimmed* text on a + // filled background renders as an apparently EMPTY highlighted bar — the + // WebGL renderer applies dim by cutting the foreground alpha, so e.g. the + // grey "message above" rows Claude Code draws lost their text entirely, + // while the same output stayed legible in iTerm. 4.5 is the WCAG AA ratio; + // xterm only nudges a foreground when it falls below it, so normal colors + // are left alone. + minimumContrastRatio: 4.5 }); var fit = new FitAddon.FitAddon(); term.loadAddon(fit);