tmux: hardcoded chalk level downgrade ignores truecolor-capable terminals
Bug Description
Claude Code unconditionally downgrades chalk from level 3 (truecolor/16M) to level 2 (256-color) when running inside tmux, regardless of whether the tmux session actually supports truecolor. This causes all UI colors to appear muted/toned-down compared to running in a raw terminal.
Root Cause
The ink2 renderer contains a hardcoded function (introduced in 2.1.77 as part of "Fixed background colors rendering as terminal-default inside tmux"):
function HYK() {
if (process.env.TMUX && KT.level > 2)
return KT.level = 2, true; // unconditionally caps to 256-color
return false;
}
This runs after FORCE_COLOR detection, overriding it. Setting FORCE_COLOR=3 in settings.json env block has no effect because the tmux downgrade fires later.
Impact
- All hex colors (e.g., Claude orange
#FF6600) get approximated to the nearest 256-color palette match, resulting in visibly duller/muted colors - The
FORCE_COLOR=3env var workaround does not work because the downgrade runs after initial chalk level detection - Affects all tmux users, including those with terminals that fully support truecolor through tmux (Ghostty, iTerm2, Kitty, WezTerm with
Tcterminal-override)
Environment
- Terminal: Ghostty (supports truecolor natively)
- tmux: 3.6a with
set -ga terminal-overrides ",xterm-ghostty:Tc,tmux-256color:Tc" - COLORTERM:
truecolor(set correctly inside tmux) - tmux client_termfeatures:
bpaste,ccolour,clipboard,cstyle,focus,RGB,title(RGB confirmed) - Truecolor passthrough: Verified working — smooth 24-bit gradient renders correctly in tmux
- Claude Code versions affected: 2.1.77 through 2.1.80 (current)
- Last working version: 2.1.76
Steps to Reproduce
- Open Ghostty (or any truecolor terminal)
- Start tmux with truecolor enabled (
Tcflag in terminal-overrides) - Launch Claude Code inside tmux — colors appear muted
- Launch Claude Code outside tmux (raw Ghostty) — colors are vibrant and correct
- Compare side by side — tmux version is noticeably toned down
Expected Behavior
Claude Code should render full truecolor (chalk level 3) inside tmux when the terminal supports it. The function should check COLORTERM=truecolor or tmux's Tc capability before downgrading, rather than blanket-capping all tmux sessions to 256-color.
Suggested Fix
Replace the unconditional tmux downgrade:
// Current (broken for truecolor-capable terminals)
if (process.env.TMUX && KT.level > 2) return KT.level = 2, true;
// Suggested (respect COLORTERM and FORCE_COLOR)
if (process.env.TMUX && KT.level > 2
&& process.env.COLORTERM !== 'truecolor'
&& process.env.COLORTERM !== '24bit'
&& process.env.FORCE_COLOR !== '3')
return KT.level = 2, true;
Or better: check tmux's terminal features for RGB/Tc support before downgrading.
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗