Skip to content

ansi theme is rendered as explicit RGB colors instead of terminal ANSI palette indices #12890

@tummetott

Description

@tummetott

What version of Codex CLI is running?

codex-cli 0.105.0

What subscription do you have?

Pro

Which model were you using?

gpt-5.3-codex

What platform is your computer?

Darwin 24.6.0 arm64 arm

What terminal emulator and version are you using (if applicable)?

Wezterm

What issue are you seeing?

Continuation of #1618

When tui.theme = "ansi" is selected, the displayed syntax colors do not follow the terminal’s configured ANSI palette. The current behavior appears to render syntax highlighting with explicit RGB values, which bypasses ANSI index mapping in the terminal.

So in other words: the ansi theme is just another bundled theme that hardcodes random colors instead of using the ANSI-indexed terminal-palette

Relevant code paths suggest this behavior is intentional in current implementation:

codex-rs/tui/src/render/highlight.rs:125: maps ansi to EmbeddedThemeName::Ansi
codex-rs/tui/src/render/highlight.rs:380: applies syntax fg as RtColor::Rgb(fg.r, fg.g, fg.b)
codex-rs/tui/src/render/highlight.rs:371: comments that syntax themes produce RGB colors

What steps can reproduce the bug?

  1. Configure a terminal with clearly customized ANSI palette colors.
  2. Set Codex config to:
[tui]
theme = "ansi"
  1. Open Codex TUI and view syntax-highlighted code content.
  2. Compare token colors against terminal ANSI palette slots.

What is the expected behavior?

When using the ansi theme, codex should actually use the terminals ansi palette and don't hardcode some random RGB color for syntax highlighting

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    TUIIssues related to the terminal user interface: text input, menus and dialogs, and terminal displaybugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions