Skip to content

invisible text when using light theme: dark text over dark textarea #16411

Closed as not planned

Description

@franchesoni

What version of Codex CLI is running?

codex-cli 0.118.0

What subscription do you have?

plus

Which model were you using?

No response

What platform is your computer?

Linux 6.18.7-76061807-generic x86_64 x86_64

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

COSMIC Terminal

What issue are you seeing?

when i run codex on light theme i see the following

Image Image

but in dark theme i see

Image

which is correct.

In other words: light theme makes codex 1. use a dark background for the input area, 2. put a seemingly random white letter in that area, 3. display the suggested text and any text i write in dark as well, so i don't see it. That means I can only use codex with dark theme.

What steps can reproduce the bug?

Uploaded thread: 019d4818-6bc3-7753-92f4-12ff3f146a44

just run codex on light theme on pop-os COSMIC

What is the expected behavior?

No response

Additional information

No response

Activity

  1. added
    bug
    on Apr 1, 2026
  2. added
    CLI
    TUI
    on Apr 1, 2026
  3. removed
    CLI
    on Apr 2, 2026
  4. cynicalight commented on Apr 22, 2026

    @cynicalight

    i exit and reopen, the input area renders correct theme

  5. cyhbench commented on Aug 28, 2026

    @cyhbench

    Same on Windows. I measured it per-pixel so the numbers are concrete.

    Environment

    • codex-cli 0.150.1, Windows 11 (10.0.26200), Windows Terminal
    • Color scheme: built-in Solarized Light (background #FDF6E3)
    • AppsUseLightTheme = 1 and SystemUsesLightTheme = 1 — Windows is in light mode

    Measured from a screenshot

    Terminal background #FDF6E3
    Composer background #292929
    Composer text #657B83 — the terminal's own default foreground

    Codex paints the composer background but leaves the text at the terminal's default
    foreground, which is tuned for a light background. That is what makes it unreadable
    rather than merely out of place.

    Contrast ratios:

    • #657B83 on #292929 → 3.27:1 (fails WCAG AA 4.5:1)
    • #657B83 on #FDF6E3 → 4.13:1 (everywhere else in the TUI)

    No terminal-side fix exists. #292929 is neither in the xterm-256 palette
    (235 = #262626, 236 = #303030) nor in Solarized, so it is emitted as truecolor
    and cannot be remapped by the terminal. Changing the terminal foreground cannot work
    either, because the two backgrounds sit at opposite ends:

    • reaching 4.5:1 on #FDF6E3 requires relative luminance L ≤ 0.166
    • reaching 4.5:1 on #292929 requires L ≥ 0.275

    No single foreground colour satisfies both.

    Tested and does not help

    • COLORFGBG=0;15 — composer stays #292929, text unchanged
    • codex --no-alt-screen — same
    • [tui] theme — appears to be syntect syntax themes only (the value list is
      syntect's bundled set, and the TUI event is SyntaxThemeSelected); it does not
      touch the composer
    • Windows light mode is already on and is evidently not consulted

    The only thing that works is NO_COLOR=1, which removes the composer background
    entirely and makes the whole TUI readable — but it also disables diff and syntax
    colours, so it is not usable day to day.

    Ask: either honour the OS/terminal light mode on Windows the way macOS already
    does (#18942 reports the light composer does render there after a restart), or expose
    an explicit override such as [tui] theme_mode = "light" | "dark" or a --theme flag.

    Related: #18942, #21130, #27333, #2020 (closed), plus the duplicates the bot flagged
    above: #14996, #15736, #16165.

  6. hiukky commented on Oct 27, 2026

    @hiukky

    Still reproducible on 0.164.0 (Linux, Codex running inside a terminal that answers OSC 10/11 and supports DEC mode 2031).

    Codex reads the terminal's default colors once at startup and caches them. A theme switch while Codex is running leaves the composer drawn for the old background: dark-on-dark after switching to light, and light-on-light the other way. Restarting Codex picks up the new colors.

    What we measured, driving codex 0.164.0 in a pty:

    • At startup it sends OSC 10;? and OSC 11;? once. Answering rgb:fafa/fafa/fafa gives a light composer (48;2;240;240;240); answering rgb:1010/1010/1010 gives a dark one (48;2;44;44;44).
    • After startup, no event makes it query again: not a focus change (CSI O / CSI I, with focus reporting on), not a resize (SIGWINCH), and not a color-scheme report (CSI ? 997 ; 1 n).

    The focus re-query (#4673) was removed in 976129f (#35649), with the reason given in event_stream.rs: querying on focus blocks the input loop and can drop keys typed during the refresh. That tradeoff makes sense.

    Suggestion: follow DEC private mode 2031 (color-palette update notifications) instead. Codex would set CSI ? 2031 h at startup. The terminal then sends CSI ? 997 ; 1 n (dark) or CSI ? 997 ; 2 n (light) only when the scheme actually changes, so the palette would be re-queried at that moment and never on focus. Normal typing would never trigger a probe. Claude Code (theme auto) and OpenCode (theme system) already subscribe to this mode, and both follow a live theme switch in the same terminal where Codex does not.

  7. etraut-openai commented on Nov 21, 2026

    @etraut-openai
    Contributor

    (response from codex)

    Thanks for the screenshots. Older versions of COSMIC Terminal reported a black background to Codex even in light mode. Updating COSMIC Terminal to epoch-1.2.0 or later and relaunching Codex should make the input readable. COSMIC fix

    I tested Codex 0.118.0 and 0.171.0 on Linux. Both drew the exact dark gray input background from your screenshot (#1e1e1e) when the terminal reported black. When I changed only the terminal’s reply to report the light background shown in your screenshot, both drew a readable light input area.

    Closing this as fixed upstream for the original COSMIC startup issue. If the input becomes unreadable when you switch themes while Codex is running, I reproduced that on 0.171.0 and we’re tracking it in #45163.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    TUIbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions