Custom theme diffAdded/diffRemoved/diffAddedDimmed/diffRemovedDimmed overrides ignored in diff renderer (still present in 2.1.227)

Status Open
Reported on v2.1.227
Maintainer reply ✓ Yes — bcherny
Activity 3 comments · opened Aug 11, 2026
💡 Likely answer: A maintainer (bcherny, collaborator) responded on this thread — see the highlighted reply below.

Description

Custom theme color overrides for diff line backgrounds (diffAdded, diffRemoved, diffAddedDimmed, diffRemovedDimmed) have no effect on the rendered diff. The diff view always falls back to the base theme's default colors, while other overrides in the same theme file (e.g. claude) resolve and render correctly.

This appears to be the same underlying bug reported in #66937 and #69445, both closed without a fix (one as duplicate, one as stale/"not planned"). Filing fresh since it reproduces on a current version.

Environment

  • Claude Code version: 2.1.227
  • OS: macOS (Darwin), Apple Terminal.app
  • "tui": "fullscreen" in settings.json

Repro steps

  1. Create ~/.claude/themes/custom.json:
{
  "name": "custom",
  "base": "dark",
  "overrides": {
    "claude": "ansi:magenta",
    "diffAdded": "#354F0C",
    "diffRemoved": "#550021",
    "diffAddedDimmed": "#1E2D07",
    "diffRemovedDimmed": "#310013"
  }
}
  1. Set "theme": "custom:custom" in ~/.claude/settings.json
  2. Select the theme via /theme and confirm it's active
  3. Trigger any file edit/diff

Expected: diff line backgrounds use #354F0C (added) / #550021 (removed)
Actual: diff line backgrounds use the dark base theme's default diff colors; the claude override in the same file applies correctly

Notes

Per the analysis in #66937, the diff-rendering path appears to resolve colors through a different code path (currentTheme, which collapses a custom theme down to just its base name) than the rest of the UI (resolvedTheme, which correctly merges overrides). If that's still accurate, the fix is likely to make the diff renderer consult the same resolved/merged theme object used elsewhere.

View original on GitHub ↗

3 Comments

bcherny collaborator · 2 months ago

Reproduced on v2.1.233 (macOS).

Steps:

  1. Create ~/.claude/themes/custom.json with "base": "dark" and overrides "claude": "ansi:magenta", "diffAdded": "#354F0C", "diffRemoved": "#550021" (plus the dimmed variants).
  2. Set "theme": "custom:custom" in settings, start Claude Code, confirm /theme shows the custom theme selected.
  3. Ask Claude to make a small edit to a file.

Observed: the claude override applies (magenta accents), but the diff line backgrounds do not. Both the /theme preview and the real Edit diff render the removed line with background rgb(61,1,0) and the added line with rgb(2,40,0) — the same colors the built-in "Dark mode" theme uses. The #550021 / #354F0C overrides never appear.

Expected: removed lines use #550021, added lines use #354F0C.

Additional finding: the overrides DO apply when syntax highlighting is off (press ctrl+t in the /theme picker, or set "syntaxHighlightingDisabled": true). With highlighting off, the removed line background is rgb(85,0,33) = #550021 and the added line is rgb(53,79,12) = #354F0C. So the bug is specific to the syntax-highlighted diff renderer, which is the default.

Assessment: This is a genuine bug. The docs (https://code.claude.com/docs/en/terminal-config, "Diff rendering" table) say diffAdded / diffRemoved / diffAddedDimmed / diffRemovedDimmed control the background of added/removed/context lines, with no caveat about syntax highlighting. The syntax-highlighted diff path only receives the custom theme's base preset name and picks its diff palette from that, so the overrides are dropped. This is not a regression: it has been this way since custom themes were introduced, and it is still present in the current source. Workaround until fixed: turn off syntax highlighting ("syntaxHighlightingDisabled": true), which routes diffs through the renderer that honors the overrides.

🤖 Generated with Claude Code

bcherny collaborator · 1 month ago

Reproduced on v2.1.233 (Linux, fresh config, truecolor terminal), following the exact repro steps in the report. With the custom theme active, diff line backgrounds ignore the diffAdded/diffRemoved/diffAddedDimmed/diffRemovedDimmed overrides and render the built-in diff colors, while other overrides in the same theme file (e.g. claude) apply correctly.

The overrides are honored by the plain (non-syntax-highlighted) diff renderer: with syntax highlighting turned off, the diff backgrounds render exactly the override colors from the theme file. So the gap is specific to the syntax-highlighted diff renderer, which resolves diff colors from the base theme rather than the merged custom theme — consistent with the analysis in the report. Disabling syntax highlighting is a functional workaround in the meantime.

Marking as reproduced so this can be routed for a fix.

🤖 Generated with Claude Code

yunqingy180 · 1 month ago

The same root cause affects markdown rendering, not just the diff renderer. Inline code (codespan) is styled with the permission token, but the markdown renderer receives the theme as the base name string (e.g. "dark") rather than the resolved theme, so custom overrides are silently ignored and inline code always renders the base palette color (rgb(177,185,249) on dark).

Repro on 2.1.252:

  1. Create ~/.claude/themes/pink.json with "overrides": { "permission": "#ff69b4" } and select it ("theme": "custom:pink").
  2. Have Claude output any text with inline code.
  3. The code span stays rgb(177,185,249) instead of pink, while the same override does apply to permission prompts.

The codespan/text/error/warning cases were previously reported in #52465 (closed as not planned). Since the underlying issue is the same, a fix here would ideally cover every render path that resolves the theme from the name string instead of using the merged overrides.