ANSI SGR 2 (faint/dim) not rendered in Bash tool output

Resolved 💬 3 comments Opened Mar 29, 2026 by zaydek Closed May 4, 2026

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?

\e[2m (SGR 2, faint/dim) is not rendered correctly in Bash tool output. Text styled with faint appears as normal weight instead of dimmed. The same ANSI codes render correctly when the command is run directly in the terminal via the ! prefix.

What Should Happen?

Text wrapped in \e[2m...\e[0m should render with reduced opacity/brightness in tool output, matching how it renders in the host terminal. Other SGR codes (bold \e[1m, colors \e[31m/\e[32m/\e[33m) render correctly in tool output, so SGR 2 should too.

Error Messages/Logs

Hex dump of the output confirms correct ANSI sequences are emitted:

\e[1;32mA\e[0m \e[1mfile.ts\e[0m  \e[2m# test\e[0m

The \e[0m reset before the faint sequence properly clears prior bold state. Issue is in Claude Code's ANSI renderer, not the source program.

Likely root cause: The ANSI-to-styled-text renderer probably has a map/switch for supported SGR codes. SGR 1 (bold), SGR 31-37 (colors), SGR 0 (reset) are handled. SGR 2 (faint/dim) is likely just missing from that map, so it gets ignored/stripped. The fix is probably one line: add SGR 2 -> opacity: 0.5 (or equivalent dim style) right next to where SGR 1 maps to bold.

Steps to Reproduce

  1. Ask Claude to run: printf '\e[1mBold\e[0m \e[2mFaint\e[0m Normal\n'
  2. Expand the Bash tool output (Cmd+O)
  3. Observe that "Faint" renders the same weight as "Normal"
  4. Run the same command via ! prefix: ! printf '\e[1mBold\e[0m \e[2mFaint\e[0m Normal\n'
  5. Observe that "Faint" correctly renders dimmer in the terminal

Claude Model

claude-opus-4-6

Is this a regression?

Don't know / Not sure

Last Working Version

_No response_

Claude Code Version

2.1.87 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗