You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Input bar retains its startup background after a live light/dark appearance change in Ghostty #54159
CLIIssues related to the Codex CLITUIIssues related to the terminal user interface: text input, menus and dialogs, and terminal displaybugSomething isn't working
What terminal emulator and version are you using (if applicable)?
Ghostty
Codex doctor report
What issue are you seeing?
Codex CLI’s input-bar background does not update when macOS appearance changes during a running session. Ghostty switches appearance, but the input bar retains its previous background. This can leave light text on a light background.
Environment
Codex CLI: 0.162.1
Ghostty: 1.3.1
macOS: 26.7.1
TERM=xterm-ghostty
COLORTERM=truecolor
Ghostty theme: dark:0x96f, light:Flexoki Light
The input bar retains its light background. Changing /theme does not correct it. Exiting and restarting Codex updates the bar correctly.
What steps can reproduce the bug?
Start Codex in Ghostty with macOS in light mode.
Change macOS to dark mode while Codex remains running.
Observe the input-bar background.
What is the expected behavior?
The input-bar background updates to match the new terminal appearance.
Confirmed by source inspection in rust-v0.163.0, and the same behavior remains on main ab6095d. The composer calls user_message_style() on every render (codex-rs/tui/src/bottom_pane/chat_composer.rs:4821), but that style blends a fixed RGB background from terminal_palette::default_bg() (style.rs:60,209,254-264). The OSC 10/11 result is cached at startup (terminal_palette.rs:165-194; tui.rs:492,520). Terminal-default foreground/background and ANSI palette colors can follow Ghostty's appearance change independently; this computed RGB fill cannot.
/theme changes syntax/theme-derived colors and does not refresh this palette. There is no composer-background setting. Restarting the CLI and using codex resume refreshes the probe; FORCE_COLOR=1 is a broader launch-time workaround that removes the blended fill by limiting colors to basic ANSI (verified live: Codex 0.163.0 in Ghostty on macOS, the composer stays readable across light/dark switches). NO_COLOR=1 is a monochrome fallback.
Please preserve the input-safety fix from #35649: focus handling intentionally stopped running a blocking color probe because it could consume keystrokes. A live refresh should multiplex bounded OSC replies with normal input through one reader, preserve keys/pastes, update the cached palette, and redraw. Focus gain can trigger a refresh; negotiated mode-2031 appearance notifications could also trigger it while focus stays in the terminal. An opt-out for the blended composer background would be a small independent workaround.
Ghostty uses separate light and dark themes and follows the system appearance. Switching from light to dark during a running Codex session updates the terminal colors, but Codex’s input bar retains its light background. Text can also become difficult to read. Restarting Codex fixes it until another theme switch.
Reloading Ghostty’s configuration does not refresh Codex’s input background.
Setting Ghostty’s minimum-contrast = 4.5 makes the text readable again, but the input bar still retains its previous background. This helps with readability, but doesn’t resolve the underlying issue.
Adding a working reference implementation and runtime validation, building on the source analysis above. I encountered the same unreadable composer with Codex CLI 0.165.0 in cmux on macOS.
I’ve kept the code PRs in my forks to follow the contribution policy. They are linked here as implementation and test evidence for a maintainer-owned fix:
The source investigation and Codex integration are based on upstream commit 6c776cfc8c3b2aa4e429813c52c0e044ff01104b.
What needs to change
The composer recalculates its style when rendered, but its explicit RGB fill is derived from the startup-cached terminal background. When the terminal changes its default foreground, that old fill can remain and make the text unreadable.
The existing focus handler deliberately avoids re-running the synchronous probe to protect input (#35649). There is also an input-layer gap: the pinned crossterm fork already parses OSC colour replies internally, but its ordinary asynchronous event stream filters those reports out. Invalidating the palette cache alone does not provide a safe runtime refresh path.
Implemented approach
Keep one normal input reader. Add an opt-in TerminalEventStream that delivers ordinary keyboard, paste, mouse, focus and resize events alongside OSC 10/11 replies and colour-scheme reports. This reuses crossterm’s input owner; the refresh path does not open a competing reader or wait for terminal replies in the UI handler. The existing Event API and ordinary EventStream filtering remain available. Input-stream code.
Handle focused theme changes and focus regain. Subscribe with CSI ? 2031 h; parse CSI ? 997 ; 1 n / CSI ? 997 ; 2 n. Treat the notification as a trigger to query the actual OSC 10/11 RGB values. Focus gain and return from terminal handoff also request a refresh. Reporting is disabled during terminal restoration/editor handoff and suspend, then restored when Codex regains ownership. This also addresses the focused-switch case described in TUI: set DECSET 2031 so an in-place terminal theme change updates the composer colours #38575.
Publish only a complete palette. Coalesce requests while one is outstanding, with a 250 ms acceptance window. Apply foreground/background together only after both valid replies arrive within that window. Missing replies, a missing colour slot, invalid payloads, and replies outside the window preserve the last good palette; a later trigger can retry. Refresh state machine and tests.
Invalidate painted content and draw. A changed palette updates the cache, advances the rendered-content revision, and emits a draw event. It preserves the selected syntax theme and the draft. Event handling.
Keep fragmented replies out of the prompt. A PTY test exposed an additional issue: an OSC reply split immediately after its Escape byte could be emitted as ordinary keys. The input-library change preserves that prefix across reads in both Unix backends, using the existing 20 ms Escape ambiguity window. This changes standalone Escape timing and deserves review. Transport regression test.
Validation performed
Full integration type-check:cargo check -p codex-tui --tests --locked passed from codex-rs with the pinned Rust 1.95 toolchain, without compiler workarounds.
Optimized application: built a native macOS 27.2 / arm64 CLI package with matching helper executables, installed it locally, and verified executable signatures. The source build reports 0.0.0; its recorded source commit is ec16e6a.
Packaged CLI in a PTY: the actual composer changed light → dark → light without focus transitions. Its fill changed between RGB 244/244/244 and 30/30/30. Draft typing immediately following a focus report survived an unanswered palette refresh. This exercised the packaged application’s composer.
Broader event/palette harness: passed both switching directions, fragmented and reordered replies, typing and bracketed-paste ordering, pasted literal report bytes, missing/malformed replies, late replies, and recovery on a later refresh. 31 focused tests passed using the actual affected Codex source modules; unrelated host surfaces were stubbed in that harness.
Input-library suites:146 passed / 7 ignored on the default Unix backend and 144 passed / 7 ignored with use-dev-tty. Final runs used --test-threads=1 after an intermittent concurrent failure in existing colour-formatting tests.
Rust formatting, whitespace checks, and Bazel module-lock regeneration/verification passed.
Scope and remaining validation
This Unix reference implementation includes a crossterm dependency change. Both Cargo and Bazel lockfiles pin the input-library fork revision.
The full Codex test suite, manual macOS appearance switching in cmux/Ghostty after installation, manual editor/suspend exercises, and Linux/Windows runtime validation have not been completed. The application-level results above are PTY-based. Focused theme switches depend on the terminal and any multiplexer delivering mode-2031 reports; focus-gain refresh provides the fallback. Already-emitted native terminal scrollback is not repainted by this change.
Could this be triaged for a maintainer-owned TUI/input fix, with preserving typing/paste during unanswered queries and handling focused theme changes included in the acceptance criteria? The fork PRs provide the concrete code path and regression tests for that discussion.
Additional report: this still occurs with Codex CLI 0.166.0 in Ghostty 1.4.0 on macOS 27.2.
During a running Codex session, switching between light and dark appearance updates the normal text and terminal background correctly, but the prompt input box retains its previous background. The input text changes color and becomes unreadable against the stale input-box background. The user reports this in both directions: light → dark and dark → light.
Reproduction based on the user's observation:
Start an interactive Codex CLI session in Ghostty.
Switch the light/dark appearance while the session remains running.
Observe that the normal terminal colors update, while the prompt input-box background does not.
Switch in the opposite direction and observe the same readability problem.
Expected: the input-box background and foreground update together and remain readable after either appearance change, without restarting the session.
Locally verified environment:
codex --version: codex-cli 0.166.0
TERM_PROGRAM=ghostty
TERM_PROGRAM_VERSION=1.4.0
TERM=xterm-ghostty
COLORTERM=truecolor
macOS: 27.2 (build 26B123)
Relevant Codex setting: [tui] theme = "github"
The symptom is user-observed; environment details were checked locally. Restart/resume was suggested but has not been confirmed as a workaround in this environment. No logs or session transcripts are attached.
CLIIssues related to the Codex CLITUIIssues related to the terminal user interface: text input, menus and dialogs, and terminal displaybugSomething isn't working
Activity
durandom commentedon Oct 20, 2026
Confirmed by source inspection in rust-v0.163.0, and the same behavior remains on main ab6095d. The composer calls user_message_style() on every render (codex-rs/tui/src/bottom_pane/chat_composer.rs:4821), but that style blends a fixed RGB background from terminal_palette::default_bg() (style.rs:60,209,254-264). The OSC 10/11 result is cached at startup (terminal_palette.rs:165-194; tui.rs:492,520). Terminal-default foreground/background and ANSI palette colors can follow Ghostty's appearance change independently; this computed RGB fill cannot.
/theme changes syntax/theme-derived colors and does not refresh this palette. There is no composer-background setting. Restarting the CLI and using codex resume refreshes the probe; FORCE_COLOR=1 is a broader launch-time workaround that removes the blended fill by limiting colors to basic ANSI (verified live: Codex 0.163.0 in Ghostty on macOS, the composer stays readable across light/dark switches). NO_COLOR=1 is a monochrome fallback.
Please preserve the input-safety fix from #35649: focus handling intentionally stopped running a blocking color probe because it could consume keystrokes. A live refresh should multiplex bounded OSC replies with normal input through one reader, preserve keys/pastes, update the cached palette, and redraw. Focus gain can trigger a refresh; negotiated mode-2031 appearance notifications could also trigger it while focus stays in the terminal. An opt-out for the blended composer background would be a small independent workaround.
lukaboulpaep commentedon Oct 26, 2026
I can reproduce this on NixOS with Hyprland, so it also affects Linux.
Codex CLI:
0.160.0Ghostty:
1.3.1Hyprland:
0.55.4Ghostty uses separate light and dark themes and follows the system appearance. Switching from light to dark during a running Codex session updates the terminal colors, but Codex’s input bar retains its light background. Text can also become difficult to read. Restarting Codex fixes it until another theme switch.
Reloading Ghostty’s configuration does not refresh Codex’s input background.
Setting Ghostty’s
minimum-contrast = 4.5makes the text readable again, but the input bar still retains its previous background. This helps with readability, but doesn’t resolve the underlying issue.rodchristiansen commentedon Oct 29, 2026
Adding a working reference implementation and runtime validation, building on the source analysis above. I encountered the same unreadable composer with Codex CLI 0.165.0 in cmux on macOS.
I’ve kept the code PRs in my forks to follow the contribution policy. They are linked here as implementation and test evidence for a maintainer-owned fix:
The source investigation and Codex integration are based on upstream commit
6c776cfc8c3b2aa4e429813c52c0e044ff01104b.What needs to change
The composer recalculates its style when rendered, but its explicit RGB fill is derived from the startup-cached terminal background. When the terminal changes its default foreground, that old fill can remain and make the text unreadable.
The existing focus handler deliberately avoids re-running the synchronous probe to protect input (#35649). There is also an input-layer gap: the pinned crossterm fork already parses OSC colour replies internally, but its ordinary asynchronous event stream filters those reports out. Invalidating the palette cache alone does not provide a safe runtime refresh path.
Implemented approach
Keep one normal input reader. Add an opt-in
TerminalEventStreamthat delivers ordinary keyboard, paste, mouse, focus and resize events alongside OSC 10/11 replies and colour-scheme reports. This reuses crossterm’s input owner; the refresh path does not open a competing reader or wait for terminal replies in the UI handler. The existingEventAPI and ordinaryEventStreamfiltering remain available. Input-stream code.Handle focused theme changes and focus regain. Subscribe with
CSI ? 2031 h; parseCSI ? 997 ; 1 n/CSI ? 997 ; 2 n. Treat the notification as a trigger to query the actual OSC 10/11 RGB values. Focus gain and return from terminal handoff also request a refresh. Reporting is disabled during terminal restoration/editor handoff and suspend, then restored when Codex regains ownership. This also addresses the focused-switch case described in TUI: set DECSET 2031 so an in-place terminal theme change updates the composer colours #38575.Publish only a complete palette. Coalesce requests while one is outstanding, with a 250 ms acceptance window. Apply foreground/background together only after both valid replies arrive within that window. Missing replies, a missing colour slot, invalid payloads, and replies outside the window preserve the last good palette; a later trigger can retry. Refresh state machine and tests.
Invalidate painted content and draw. A changed palette updates the cache, advances the rendered-content revision, and emits a draw event. It preserves the selected syntax theme and the draft. Event handling.
Keep fragmented replies out of the prompt. A PTY test exposed an additional issue: an OSC reply split immediately after its Escape byte could be emitted as ordinary keys. The input-library change preserves that prefix across reads in both Unix backends, using the existing 20 ms Escape ambiguity window. This changes standalone Escape timing and deserves review. Transport regression test.
Validation performed
cargo check -p codex-tui --tests --lockedpassed fromcodex-rswith the pinned Rust 1.95 toolchain, without compiler workarounds.0.0.0; its recorded source commit isec16e6a.use-dev-tty. Final runs used--test-threads=1after an intermittent concurrent failure in existing colour-formatting tests.Scope and remaining validation
This Unix reference implementation includes a crossterm dependency change. Both Cargo and Bazel lockfiles pin the input-library fork revision.
The full Codex test suite, manual macOS appearance switching in cmux/Ghostty after installation, manual editor/suspend exercises, and Linux/Windows runtime validation have not been completed. The application-level results above are PTY-based. Focused theme switches depend on the terminal and any multiplexer delivering mode-2031 reports; focus-gain refresh provides the fallback. Already-emitted native terminal scrollback is not repainted by this change.
Could this be triaged for a maintainer-owned TUI/input fix, with preserving typing/paste during unanswered queries and handling focused theme changes included in the acceptance criteria? The fork PRs provide the concrete code path and regression tests for that discussion.
suchoss commentedon Nov 6, 2026
Additional report: this still occurs with Codex CLI 0.166.0 in Ghostty 1.4.0 on macOS 27.2.
During a running Codex session, switching between light and dark appearance updates the normal text and terminal background correctly, but the prompt input box retains its previous background. The input text changes color and becomes unreadable against the stale input-box background. The user reports this in both directions: light → dark and dark → light.
Reproduction based on the user's observation:
Expected: the input-box background and foreground update together and remain readable after either appearance change, without restarting the session.
Locally verified environment:
codex --version:codex-cli 0.166.0TERM_PROGRAM=ghosttyTERM_PROGRAM_VERSION=1.4.0TERM=xterm-ghosttyCOLORTERM=truecolor27.2(build26B123)[tui] theme = "github"The symptom is user-observed; environment details were checked locally. Restart/resume was suggested but has not been confirmed as a workaround in this environment. No logs or session transcripts are attached.