Skip to content

fix(terminal): dimmed text on a filled background no longer renders invisible - #279

Closed
vakovalskii wants to merge 1 commit into
mainfrom
fix/terminal-dim-contrast
Closed

fix(terminal): dimmed text on a filled background no longer renders invisible#279
vakovalskii wants to merge 1 commit into
mainfrom
fix/terminal-dim-contrast

Conversation

@vakovalskii

Copy link
Copy Markdown
Owner

Симптом

В панели Terminal строки, которые Claude Code рисует приглушённым текстом на залитом фоне (серые полосы «сообщение выше»), выглядели как пустые серые полосы вообще без текста. Тот же самый вывод в iTerm читается нормально — то есть текст не терялся, а не отрисовывался.

Репортил @vakovalskii, воспроизводится повсеместно, а не в каком-то одном месте.

Причина

Найдена в вендоренном xterm.js:

minimumContrastRatio||(0…)         // при значении 1 вся ветка коротко замыкается
minimumContrastRatio/(s.isDim(…)   // для dim-ячеек порог считается отдельно

Коррекция контраста целиком закрыта за этой опцией, а её дефолт — 1, то есть выключено. Мы её не выставляли. WebGL-рендерер реализует dim через срез альфы переднего плана, поэтому без коррекции приглушённый текст на залитом фоне схлопывается до неразличимого. iTerm приглушает мягче, отсюда разница.

Оба наших аддона опцию учитывают: addon-webgl.js и addon-canvas.js ссылаются на неё и активно работают с dim (21 и 13 упоминаний соответственно).

Фикс

Одна строка — minimumContrastRatio: 4.5 (WCAG AA) в опциях Terminal. xterm правит цвет только когда контраст падает ниже порога, поэтому обычные цвета темы не затрагиваются.

Проверка

  • node --test test/*.test.js → 253 passed / 0 failed / 2 skipped
  • Визуально проверяется так: node bin/cli.js run на этой ветке → вкладка Terminal → запустить агента и прокрутить историю; серые полосы должны показывать текст.

Отдельно отмечу: в ходе разбора я сначала ошибочно списал это на служебную обёртку <local-command-caveat> в транскрипте (она действительно рисуется как пустой серый бокс, но только у !-команд) — сообщение @vakovalskii «такое у меня везде» это опровергло и вывело на настоящую причину.

🤖 Generated with Claude Code

…nvisible

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) <noreply@anthropic.com>
vakovalskii added a commit that referenced this pull request Jul 30, 2026
* fix(terminal): dimmed text on a filled background no longer renders invisible

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) <noreply@anthropic.com>

* feat(terminal): name a terminal pane yourself

The pane title bar showed only an auto-label — the running agent, the project
folder, or a bare '~' for home. With several panes open in the same folder (or
several shells in $HOME) they were indistinguishable.

You can now give a pane its own name: click the ✎ in its title bar, or
double-click the title. An empty answer clears the name and restores the
auto-label. Uses codbashPrompt (window.prompt is a no-op in the Electron shell).

The name round-trips: it is captured into the session snapshot and saved
layouts, restored at every pane-construction site, and sanitizePane now
preserves it (reusing the existing MAX_NAME=120 cap and rejecting control
characters, like the other pane fields).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* release: 7.17.0 — named terminal panes + readable dimmed text

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
@vakovalskii

Copy link
Copy Markdown
Owner Author

Вошло в 7.17.0 через релиз-кандидат #281 (main @ 8b9bf7d). Закрываю как включённое.

Напомню суть на будущее: коррекция контраста в xterm.js целиком закрыта за minimumContrastRatio, а её дефолт 1 = выключено, поэтому dim-текст на залитом фоне схлопывался до неразличимого именно в WebGL-рендерере.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant