Feature: transparent_background option to preserve terminal transparency
Problem
Codex TUI paints opaque background tints on message bubbles, composer panels, and diff lines. This breaks terminal transparency, blur effects, and image backgrounds for users who rely on those features.
The transparent codepaths already exist
The codebase already implements this philosophy in multiple places:
Syntax highlighting (highlight.rs):
// Intentionally skip background to avoid overwriting terminal bg.
The convert_style function deliberately omits backgrounds from syntax themes so the terminal's own background shows through.
Message styles (style.rs):
pub fn user_message_style_for(terminal_bg: Option<(u8, u8, u8)>) -> Style {
match terminal_bg {
Some(bg) => Style::default().bg(user_message_bg(bg)),
None => Style::default(), // <-- no background
}
}
When terminal_bg is None, both user_message_style_for and proposed_plan_style_for already return Style::default() — no background tint at all.
Diff rendering (diff_render.rs):
//! ANSI-16 mode always uses foreground-only styling regardless of theme scope backgrounds.
The ANSI-16 fallback path returns foreground-only styles (Style::default().fg(Color::Green) / Color::Red) with no backgrounds, and fallback_diff_backgrounds returns ResolvedDiffBackgrounds::default() for ANSI-16.
Proposal
Add a single boolean config option following the existing animations / show_tooltips pattern:
[tui]
transparent_background = true # default: false
When enabled, the TUI would route to the existing background-free codepaths:
user_message_style()/proposed_plan_style()→ returnStyle::default()(same as whenterminal_bgisNone)resolve_diff_backgrounds()→ returnResolvedDiffBackgrounds::default()(same as ANSI-16 fallback)- Gutter backgrounds skipped (same pattern)
Default behavior is completely unchanged. The option defaults to false.
Scope
~50 lines across 5 files:
codex-rs/core/src/config/types.rs— add field toTuistructcodex-rs/core/src/config/mod.rs— map toConfigcodex-rs/tui/src/style.rs— early return when transparentcodex-rs/tui/src/diff_render.rs— skip backgrounds when transparentcodex-rs/tui/src/lib.rs— wire up at startup
Happy to contribute a PR if invited.
5 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Sorry for the noise here. I ran into the same issue myself, so I put together a patch on my fork, but GitHub is preventing me from opening a PR because pull requests to
openai/are limited to repository collaborators.codex
The implementation is available here:
Visio-Vanitas/codexanon/tui-transparent-backgroundef4ce5fbe(add tui transparent background option)This change adds a
tui.transparent_backgroundoption to the Rust TUI so major surfaces can omit explicit background fills and terminal transparency can show through whensupported. It also preserves diff foreground readability in transparent mode and includes tests/snapshots.
Validated with:
cargo fmt --allcargo clippy -p codex-config -p codex-core -p codex-tui --tests --all-targets -- -D warningscargo test -p codex-core tui_transparent_background -- --nocapturecargo test -p codex-tui transparent_background -- --nocaptureIf this direction looks good, a maintainer could open a PR from this branch or cherry-pick the commit.
The text with background color is generally hard to read (green on green, red on red for diffs for example). This is not an exotic problem with transparent terminal windows. This affects also users that use a plain terminal emulator without any transparency.
Unfortunately all "duplicates" which complain about the background color being set since 0.105 have been closed without the problem being resolved.
This is not a terminal emulation issue. This is a codex issue. I fully support the suggested fix, except that I would vote to set the default to true which was the pre 0.105 behavior which everyone was happy with. The new behavior with background colors is _broken_.
Can this please be escalated to a defect. This is not an enhancement request.
I would suggest revisiting
/themeand expanding it a bit, similar to some of the previously closed issues such as #12749. I may be missing some context on why those were closed, but this still feels like a reasonable direction to explore.I implemented a local prototype to illustrate this idea and pushed it to my branch here:
The current behavior in my prototype is:
/themeopens a secondary theme menu instead of jumping directly into syntax theme selection/theme syntaxopens the syntax theme picker/theme backgroundopens a background mode picker[tui].background_modeFor background behavior, the modes are currently defined as:
auto: keep Codex default behavioropaque: always paint Codex panel and diff backgroundsclassic: preserve normal UI/panel backgrounds while restoring the older diff styletransparent: avoid painting explicit panel and diff backgroundsI tested this locally on my Mac, and the prototype works well in practice. In particular, I verified:
/thememenu flow works as expected/theme syntaxand/theme backgroundboth dispatch correctlyclassicandtransparentboth improve readability for transparent terminal setupsValidation used for the prototype:
``
bash
``cargo test -p codex-core tui_background_mode
cargo test -p codex-core config_schema_matches_fixture
cargo test -p codex-tui classic_
cargo test -p codex-tui background_transparency_enabled_follows_mode
cargo test -p codex-tui slash_theme_background_opens_background_mode_picker
cargo check -p codex-config -p codex-core -p codex-tui
I have attached a screenshot below to show the general direction. I hope this is useful:
<img width="1920" height="1080" alt="Image" src="https://github.com/user-attachments/assets/5b5562b7-ca0c-4de5-83d7-612236660b5e" />
This is a very frustrating issue that is also still occurring on the built-in ChromeOS terminal app and making diffs unreadable.