[BUG] Markdown code block syntax highlighting uses basic ANSI colors instead of true color

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

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Claude Code's markdown renderer uses ANSI color 4 (\e[34m, dark blue) for keywords in fenced code blocks, making them nearly unreadable on dark terminal backgrounds. However, the Write tool's diff preview for the same code uses correct 24-bit true color (monokai). Both renderers are in the same session, same terminal, proving the terminal supports true color.

I'm using /theme of dark

What Should Happen?

Fenced code blocks use true color like the rest of the UI.

Error Messages/Logs

Steps to Reproduce

Ask Claude Code:

Write a 5-line Go program to /tmp/color-test.go, then also display it in a code block

The Write preview has correct monokai colors, the markdown code block has dark blue keywords.

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.170 (Claude Code)

Platform

AWS Bedrock

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Xterm

Additional Information

<img width="800" height="561" alt="Image" src="https://github.com/user-attachments/assets/a330740b-2352-4bff-8b30-343ad366ccf5" />

View original on GitHub ↗

4 Comments

JesseDeppisch · 1 month ago

Checked various other /themes. Confirmed the fenced-block colors are invariant across dark, light, and dark-ansi — the markdown highlighter appears to bypass the theme system entirely, not just fall back to 16-color.

JesseDeppisch · 1 month ago

Reproducible in Claude v2.1.217 as well.

JesseDeppisch · 26 days ago

Bump, got an email that claude-issue-triage.yml had failed. Not sure how to re-run

bcherny collaborator · 14 days ago

Confirmed — reproduced on 2.1.233 (Linux, xterm-256color with COLORTERM=truecolor).

Fenced code blocks in Claude's responses render keywords with the basic ANSI blue escape (\e[34m) and strings with ANSI red, so their appearance depends entirely on your terminal's 16-color palette — on many dark palettes ANSI blue is a hard-to-read navy. Meanwhile the Write/Edit diff previews use the syntax theme engine (Monokai by default) with palette-independent colors, which is the mismatch you observed.

This isn't a regression from a specific version: markdown code blocks have used the fixed 16-color scheme since code-block highlighting was introduced, and the truecolor syntax theme engine currently only covers file previews and diffs. We agree the two should be consistent, and we're treating this as a bug — extending theme-based highlighting to markdown code blocks is the likely fix.

Workarounds for now: adjust your terminal's ANSI blue, or disable syntax highlighting via /theme (ctrl+t).

🤖 Generated with Claude Code