Custom themes are ignored in markdown rendering: inline code uses the built-in dark colors
Version: Claude Code 2.1.288, macOS (Darwin 27.0), Ghostty
Description
With a custom theme active, inline code spans (` foo ) and fenced code blocks without a language are still drawn in the built-in dark theme's permission color (lavender rgb(177,185,249)). The custom theme's permission` override is not used there. Other UI elements (borders, prompt, permission dialogs) use the custom colors correctly.
Steps to reproduce
- Create
~/.claude/themes/kanagawa-dragon.json:
``json``
{
"name": "Kanagawa Dragon",
"base": "dark",
"overrides": { "permission": "#8ba4b0" }
}
- Select it with
/theme. It reportsUsing custom theme "Kanagawa Dragon", andsettings.jsoncontains"theme": "custom:kanagawa-dragon". - Ask Claude something whose answer includes inline code, e.g. `
--vol 0.35`.
Expected: Inline code is drawn in #8ba4b0.
Actual: Inline code is drawn in lavender rgb(177,185,249), the built-in dark value.
Likely cause (from the bundled JS)
The markdown renderer colors code spans with:
case "codespan": return On("permission", t)(e.text);
On resolves its theme argument like this:
let i = typeof r === "string" ? oF(r) : r;
oF only recognizes built-in theme names:
function oF(r){switch(r){case"light":…case"light-ansi":…case"dark-ansi":…
case"light-daltonized":…case"dark-daltonized":…default:return B}}
The theme passed down the markdown path seems to be the name string ("custom:kanagawa-dragon"). It then lands in default and resolves to the built-in dark palette, so neither the custom overrides nor the base field are applied. The same applies to unlabeled fenced code blocks (case "code" → On("permission", t)).
Suggested fix
Pass the resolved theme object (custom overrides merged on top of base) into the markdown renderer, or make oF resolve custom:* names.
Workaround
None that keeps the custom theme. Switching to dark-ansi makes code spans follow the terminal palette, but drops all the custom colors.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗