Custom theme diffAdded/diffRemoved/diffAddedDimmed/diffRemovedDimmed overrides ignored in diff renderer (still present in 2.1.227)
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
- Create
~/.claude/themes/custom.json:
{
"name": "custom",
"base": "dark",
"overrides": {
"claude": "ansi:magenta",
"diffAdded": "#354F0C",
"diffRemoved": "#550021",
"diffAddedDimmed": "#1E2D07",
"diffRemovedDimmed": "#310013"
}
}
- Set
"theme": "custom:custom"in~/.claude/settings.json - Select the theme via
/themeand confirm it's active - 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.
3 Comments
Reproduced on v2.1.233 (macOS).
Steps:
~/.claude/themes/custom.jsonwith"base": "dark"and overrides"claude": "ansi:magenta","diffAdded": "#354F0C","diffRemoved": "#550021"(plus the dimmed variants)."theme": "custom:custom"in settings, start Claude Code, confirm/themeshows the custom theme selected.Observed: the
claudeoverride applies (magenta accents), but the diff line backgrounds do not. Both the/themepreview and the real Edit diff render the removed line with backgroundrgb(61,1,0)and the added line withrgb(2,40,0)— the same colors the built-in "Dark mode" theme uses. The#550021/#354F0Coverrides 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
/themepicker, or set"syntaxHighlightingDisabled": true). With highlighting off, the removed line background isrgb(85,0,33)=#550021and the added line isrgb(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/diffRemovedDimmedcontrol 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
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/diffRemovedDimmedoverrides 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
The same root cause affects markdown rendering, not just the diff renderer. Inline code (codespan) is styled with the
permissiontoken, 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:
~/.claude/themes/pink.jsonwith"overrides": { "permission": "#ff69b4" }and select it ("theme": "custom:pink").inline code.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.