[BUG] Permission prompt rule-pattern text invisible on dark terminal backgrounds
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?
Summary
Claude Code CLI renders the rule-pattern segment inside "Ask rule ... overrides auto mode" permission messages using an explicit near-black/black foreground color. On any sufficiently dark terminal background, that text is effectively invisible.
What Should Happen?
Expected Behavior
The rule pattern in Ask rule <pattern> overrides auto mode for this command. should be legible on any terminal color scheme (light or dark) — ideally by inheriting the terminal's theme-aware default foreground rather than a hardcoded dark color.
Actual Behavior
The <pattern> segment renders at the same luminance as the background and appears blank, while the surrounding sentence ("Ask rule", "overrides auto mode for this command.") renders normally. The text is present and can still be selected/copied with the mouse — this is a color/rendering bug, not missing content.
Error Messages/Logs
Steps to Reproduce
Steps to Reproduce
- Use a terminal (confirmed in iTerm2) with a dark background profile.
- Trigger a permission "ask" rule while in
autopermission mode, producing:Ask rule <pattern> overrides auto mode for this command. - Observe:
<pattern>is unreadable, appearing as a blank gap in the sentence.
Root Cause (found via binary inspection)
In the installed CLI binary, the relevant code is:
let o = rr.bold(n(Ip(e.rule.ruleValue)));
...
reasonString: `Ask rule ${o} overrides auto mode for this ${t}.`
rr.bold(...) only applies the bold SGR attribute — it doesn't explain the invisibility on its own. The dark color must come from n() / Ip().
Diagnostic Evidence
Ran in the affected terminal to isolate the exact color mechanism:
printf '\033[1mBOLD\033[0m | \033[2mDIM\033[0m | \033[30mANSI-BLACK\033[0m | \033[38;5;238mGRAY238\033[0m | \033[38;2;20;20;20mTRUECOLOR\033[0m\n'
Result: BOLD, DIM, GRAY238 all rendered visibly. ANSI-BLACK (SGR 30 / ANSI color index 0) and TRUECOLOR (RGB 20,20,20) rendered invisible against a background of RGB ~25,25,25.
This points to Ip()/n() coloring the rule-pattern text with ANSI black or a near-black truecolor value — a hardcoded dark color that collides with any sufficiently dark background, not just one specific shade.
Also confirmed this is not terminal-side fixable: raising iTerm2's "Minimum Contrast" profile setting to its maximum (1.0) had no effect on the invisible text, suggesting the color bypasses iTerm's contrast-correction pipeline for this code path (possibly due to the combined bold+explicit-color SGR sequence).
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.236
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
Environment
- Tool/Component: Claude Code CLI, version 2.1.236 (Homebrew Cask install,
/opt/homebrew/Caskroom/claude-code/2.1.236/claude) - OS: macOS (Darwin 25.6.0)
- Terminal: iTerm2, custom dark profile (background ~RGB 25,25,25, Meslo LG M for Powerline font)
Workaround
Select the invisible text with the mouse and copy it (Cmd+C) to reveal its content via clipboard.
Additional Context
Likely affects any dark-themed terminal setup (default iTerm2 dark presets, Terminal.app dark mode, etc.), not just this specific custom profile — the underlying issue is a hardcoded dark color, not a conflict with one particular background value.
Issue Search
This does not seem to be duplicate of https://github.com/anthropics/claude-code/issues/57739 as that issue is for a dark theme on a light background terminal. This is regarding dark text on a dark background terminal, making the text unreadable.