[BUG] Status line ANSI truecolor renders differently than same colors in host terminal
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?
Title: Status line ANSI truecolor renders differently than same colors in host terminal
Description:
When using a custom status line command (statusLine.type: "command"), ANSI 24-bit truecolor escape codes in the
script output render with visibly different colors compared to the same hex values rendered natively by the host
terminal (e.g. in a tmux status bar).
Setup:
- Terminal emulator with catppuccin mocha theme
- tmux running with catppuccin-tmux plugin (mocha flavour), using truecolor (terminal-overrides 'xterm-256color:RGB')
- Claude Code status line script outputting ANSI truecolor escape sequences using the same hex values as the tmux
theme
Example:
The tmux host module uses bg=#cba6f7 (catppuccin mocha magenta). The Claude Code status line script outputs
\e[48;2;203;166;247m — the exact same color. Side by side, the two pills are visibly different: the tmux pill is more
saturated, the Claude Code pill appears muted/shifted.
Expected behaviour:
\e[48;2;203;166;247m should produce the same rendered color as #cba6f7 in the host terminal.
Actual behaviour:
The color appears slightly different — same hue family but noticeably desaturated or shifted — suggesting the TUI
framework is applying some compositing, gamma correction, or color processing on top of the raw ANSI values that the
host terminal does not.
Possible cause:
The status line is rendered inside Claude Code's TUI widget layer rather than being passed directly to the terminal,
and that layer may be transforming the color values before they reach the terminal renderer.
<img width="2560" height="1600" alt="Image" src="https://github.com/user-attachments/assets/a951ac23-201f-4e8c-aaab-20a048f4cf6e" />
What Should Happen?
Colors should be similar to what is shown in Tmux if possible.
Error Messages/Logs
Steps to Reproduce
I had Claude rewrite the format of it's prompt to resemble my TMUX bling. Colors aren't matching even though Claude is noticing that the color scheme is catppuccin mocha .
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.71
Platform
Anthropic API
Operating System
Other Linux
Terminal/Shell
Other
Additional Information
❯ can you show me your config file so I can add it to the post.
● Read 1 file (ctrl+o to expand)
● ~/.claude/settings.json:
{
"statusLine": {
"type": "command",
"command": "bash ~/.claude/statusline-command.sh"
}
}
And ~/.claude/statusline-command.sh (symlinked from dotfiles):
#!/usr/bin/env bash
# Claude Code status line — catppuccin mocha pill style (matches tmux)
input=$(cat)
# Catppuccin Mocha palette (R;G;B)
THM_BG="30;30;46"
THM_FG="205;214;244"
THM_GRAY="49;50;68"
THM_MAGENTA="203;166;247" # host
THM_PINK="245;194;231" # directory
THM_BLUE="137;180;250" # context
# Powerline glyphs
L_CAP=$'\ue0b6' # left rounded cap
R_CAP=$'\ue0b4' # right rounded cap
pill() {
local color="$1" icon="$2" text="$3"
printf "\e[38;2;%sm\e[49m%s" "$color" "$L_CAP"
printf "\e[48;2;%sm\e[38;2;%sm%s " "$color" "$THM_BG" "$icon"
printf "\e[48;2;%sm\e[38;2;%sm %s" "$THM_GRAY" "$THM_FG" "$text"
printf "\e[38;2;%sm\e[49m%s" "$THM_GRAY" "$R_CAP"
printf "\e[0m"
}
host=$(hostname -s)
cwd=$(echo "$input" | jq -r '.workspace.current_dir // .cwd // ""')
cwd=$(echo "$cwd" | sed "s|^$HOME|~|")
used=$(echo "$input" | jq -r '.context_window.used_percentage // empty')
printf " "
pill "$THM_MAGENTA" "" "$host"
printf " "
pill "$THM_PINK" "" "$cwd"
if [ -n "$used" ]; then
used_int=$(printf "%.0f" "$used")
printf " "
pill "$THM_BLUE" "" "${used_int}%"
fi
The hex values (#cba6f7, #f5c2e7, #89b4fa, #313244) are exact catppuccin mocha values, directly matching what the tmux catppuccin plugin uses.
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗