anthropics / anthropics/claude-code

Custom theme diffAdded/diffRemoved overrides still ignored in file-diff view (v2.1.236); light-ansi base also renders single-word diffs invisible

オープン
#92,926 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
area:tui bug has repro platform:macos
主要言語
Python
スター
145k
フォーク
23.1k
PR マージ指標
PR 指標を取得中

説明

**Bug Description**

Custom theme `diffAdded`/`diffRemoved`/`diffAddedDimmed`/`diffRemovedDimmed`/`diffAddedWord`/`diffRemovedWord` overrides are still ignored by the file-diff renderer (Edit/Write tool-call diff cards). This is the same root cause reported in #66937 and #69445 (both closed: #66937 as stale/not-planned, #69445 as a duplicate of #66937), still reproducible on the current version.

**Version:** 2.1.236 (macOS, Ghostty terminal, termguicolors/truecolor enabled)

**Repro**

`~/.claude/themes/mono.json`:
```json
{
"base": "light-ansi",
"overrides": {
"text": "#262626",
"diffAdded": "#cce8cc",
"diffRemoved": "#f7d4d4",
"diffAddedWord": "#9fd89f",
"diffRemovedWord": "#f0aaaa"
}
}
```

1. `/theme` → select the custom theme (confirms the file parses).
2. Edit any file so a single short word changes on one line (e.g. change one word in a sentence, or one JSON value).
3. Observe the tool-call diff card.

**Expected:** Added/removed lines use the overridden `diffAdded`/`diffRemoved` backgrounds, and changed-word text is visible.

**Actual, two related symptoms:**

1. Overrides are ignored outright — the diff always renders with the `base` preset's own stock diff colors, exactly as described in #66937/#69445 (root cause there: the diff component resolves via `currentTheme`, which collapses `custom:` to the base preset name and discards `overrides`, instead of `resolvedTheme`).
2. New finding not covered by the earlier reports: under `base: "light-ansi"` specifically, a single-word (or otherwise short) added-line diff renders with **no visible text at all** — not just the wrong color, but fully invisible (apparently white-on-white), reproduced consistently across multiple independent one-word edits. Removed-line text (red) always renders fine; only the added side is affected. Switching `base` to `"light"` (non-ANSI, fixed-hex preset) avoids the invisible-text issue and gives correct green/red diff backgrounds — but as a side effect, all other UI accent/status colors and code-block syntax highlighting switch from the terminal's own (often intentionally monochrome) ANSI palette to the preset's fixed hex palette, which cannot be brought back to monochrome through `overrides` either, since those apparently aren't read by the same code paths.

**Impact:** Anyone building a low-color/monochrome custom theme is stuck choosing between (a) `light-ansi`/`dark-ansi` base, which respects the terminal's ANSI palette for everything else but makes some diffs unreadable, or (b) a non-ANSI base, which fixes diff readability but forces the base preset's full color palette onto code syntax highlighting and other accents, none of which is currently override-able.

**Request:** Fix the diff-view (and ideally syntax-highlighting) color resolution to read from `resolvedTheme` (overrides included) instead of `currentTheme`, per the root cause already identified in #69445. That would resolve both the original override-ignoring issue and this invisible-text variant in one fix.

**Related:** #66937, #69445

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

Start with the /theme entry point and reproduce the issue using ~/.claude/themes/mono.json, then make a one-word change through an Edit or Write tool call. Trace the file-diff renderer's theme resolution and verify that custom diffAdded/diffRemoved overrides affect line and word colors, including visible added text under light-ansi.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
json
領域
cli
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
活発
明瞭さ
おおむね明確
初心者へのやさしさ
55/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。