Skip to content

fix(tui): normalize legacy Terminal.app colors - #17695

Merged
OutThisLife merged 1 commit into
mainfrom
bb/fix-terminal-ansi-colors
Apr 30, 2026
Merged

fix(tui): normalize legacy Terminal.app colors#17695
OutThisLife merged 1 commit into
mainfrom
bb/fix-terminal-ansi-colors

Conversation

@OutThisLife

Copy link
Copy Markdown
Collaborator

Summary

  • Normalize non-banner TUI theme foregrounds for light legacy Apple Terminal into readable ANSI256 buckets while leaving banner/accent colors untouched.
  • Match Rich-style 256-color downgrade for raw Ink hex/rgb rendering on legacy Apple Terminal and avoid forcing truecolor on pre-Tahoe Terminal.app.
  • Render Apple Terminal dim text as muted gray instead of native faint SGR, with existing HERMES_TUI_DIM overrides preserved.

Test plan

  • npm test -- src/__tests__/theme.test.ts packages/hermes-ink/src/ink/colorize.test.ts packages/hermes-ink/src/ink/components/Text.test.ts src/__tests__/forceTruecolor.test.ts
  • npm run type-check --prefix ui-tui
  • npx eslint src/theme.ts src/__tests__/theme.test.ts packages/hermes-ink/src/ink/colorize.ts packages/hermes-ink/src/ink/colorize.test.ts packages/hermes-ink/src/ink/components/Text.tsx packages/hermes-ink/src/ink/components/Text.test.ts src/lib/forceTruecolor.ts src/__tests__/forceTruecolor.test.ts

@OutThisLife
OutThisLife force-pushed the bb/fix-terminal-ansi-colors branch from 0e22ac4 to 91a0527 Compare April 30, 2026 02:08
@OutThisLife
OutThisLife requested a review from Copilot April 30, 2026 02:09
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/tui Terminal UI (ui-tui/ + tui_gateway/) labels Apr 30, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts TUI color behavior for legacy/light macOS Terminal.app by (1) normalizing theme foreground colors into readable ANSI256 buckets (while preserving banner/accent intent), (2) aligning Ink/chalk RGB/hex downgrades with Rich’s 256-color mapping, and (3) changing how “dim” text is rendered on Apple Terminal.

Changes:

  • Add Apple Terminal light-mode heuristics and theme foreground normalization to ANSI256 for legacy/light profiles.
  • Make Ink colorize() optionally downgrade hex/rgb to Rich-compatible ANSI256 on legacy Apple Terminal (without forcing truecolor).
  • Change forceTruecolor to only apply when explicitly opted in; adjust dim rendering behavior + add tests.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
ui-tui/src/theme.ts Adds ANSI256 normalization logic for selected foreground theme colors on legacy/light Apple Terminal; updates default theme selection/skin mapping.
ui-tui/src/lib/forceTruecolor.ts Reworks truecolor forcing to be explicit-only via HERMES_TUI_TRUECOLOR.
ui-tui/src/entry.tsx Updates first-import note to match the new targeted truecolor behavior.
ui-tui/src/tests/theme.test.ts Adds coverage for Apple Terminal light default + theme normalization behavior.
ui-tui/src/tests/forceTruecolor.test.ts Updates tests for explicit-only truecolor forcing and env precedence.
ui-tui/packages/hermes-ink/src/ink/components/Text.tsx Disables ANSI dim by default on Apple Terminal and introduces a dim color fallback.
ui-tui/packages/hermes-ink/src/ink/components/Text.test.ts Adds tests for Apple Terminal dim behavior and fallback color.
ui-tui/packages/hermes-ink/src/ink/colorize.ts Adds Rich-compatible 256-color downgrade for hex/rgb on legacy Apple Terminal.
ui-tui/packages/hermes-ink/src/ink/colorize.test.ts Adds tests for downgrade gating + color-number mapping parity with Rich.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ui-tui/src/theme.ts
Comment thread ui-tui/src/theme.ts Outdated
Comment thread ui-tui/packages/hermes-ink/src/ink/components/Text.tsx Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ui-tui/src/theme.ts Outdated
Comment thread ui-tui/src/theme.ts
Comment thread ui-tui/packages/hermes-ink/src/ink/colorize.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ui-tui/packages/hermes-ink/src/ink/colorize.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ui-tui/src/theme.ts Outdated
Keep light Terminal.app TUI colors readable by normalizing non-banner theme tokens into ANSI256-safe buckets while preserving truecolor terminals.
@OutThisLife
OutThisLife force-pushed the bb/fix-terminal-ansi-colors branch from 8bd65dc to 7ed8cfe Compare April 30, 2026 03:09
@OutThisLife
OutThisLife merged commit 4cc6da8 into main Apr 30, 2026
9 of 10 checks passed
@OutThisLife
OutThisLife deleted the bb/fix-terminal-ansi-colors branch April 30, 2026 03:13
nickdlkk pushed a commit to nickdlkk/hermes-agent that referenced this pull request May 11, 2026
Keep light Terminal.app TUI colors readable by normalizing non-banner theme tokens into ANSI256-safe buckets while preserving truecolor terminals.
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
Keep light Terminal.app TUI colors readable by normalizing non-banner theme tokens into ANSI256-safe buckets while preserving truecolor terminals.
jsboige pushed a commit to jsboige/hermes-agent that referenced this pull request May 14, 2026
Keep light Terminal.app TUI colors readable by normalizing non-banner theme tokens into ANSI256-safe buckets while preserving truecolor terminals.
dannyJ848 pushed a commit to dannyJ848/hermes-agent that referenced this pull request May 17, 2026
Keep light Terminal.app TUI colors readable by normalizing non-banner theme tokens into ANSI256-safe buckets while preserving truecolor terminals.
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
Keep light Terminal.app TUI colors readable by normalizing non-banner theme tokens into ANSI256-safe buckets while preserving truecolor terminals.
Seven74AI pushed a commit to Seven74AI/hermes-agent that referenced this pull request Jun 13, 2026
Keep light Terminal.app TUI colors readable by normalizing non-banner theme tokens into ANSI256-safe buckets while preserving truecolor terminals.
waefrebeorn pushed a commit to waefrebeorn/slermes that referenced this pull request Jul 2, 2026
Keep light Terminal.app TUI colors readable by normalizing non-banner theme tokens into ANSI256-safe buckets while preserving truecolor terminals.
Gravezzz pushed a commit to Gravezzz/hermes-agent that referenced this pull request Jul 21, 2026
Keep light Terminal.app TUI colors readable by normalizing non-banner theme tokens into ANSI256-safe buckets while preserving truecolor terminals.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tui Terminal UI (ui-tui/ + tui_gateway/) P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants