Support ANSI color codes in bash command output

Resolved 💬 5 comments Opened Jan 17, 2026 by DanielAtProfound Closed Jan 17, 2026

Summary

Bash commands that produce colored output (like git log, ls --color, grep --color) have their ANSI escape codes stripped or escaped before being displayed in the terminal. The user's terminal (e.g., Ghostty, iTerm2) is fully capable of rendering these codes, but Claude Code's output pipeline prevents them from reaching the terminal.

Current Behavior

  1. Command runs and produces ANSI codes (verified by capturing with script -q /dev/null)
  2. Claude Code captures stdout as text
  3. ANSI codes are escaped/stripped during processing
  4. Output appears as plain uncolored text

Example - running git log --oneline --color=always shows plain text instead of the colored branch names, commit hashes, etc.

Desired Behavior

ANSI escape codes should be passed through to the terminal unescaped, allowing the user's terminal emulator to render colors as intended.

Possible Solutions

  • A config option like terminal.preserveAnsiCodes: true
  • A --raw-output flag for bash commands
  • Detecting when stdout is a TTY and passing codes through in that case

Environment

  • Terminal: Ghostty (but applies to any terminal with ANSI support)
  • OS: macOS

View original on GitHub ↗

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