Skip to content

fix(tui): clamp terminal foreground in light mode to prevent whitish text - #2249

Open
rekty wants to merge 1 commit into
XiaomiMiMo:mainfrom
rekty:fix/light-mode-font-color-win32
Open

fix(tui): clamp terminal foreground in light mode to prevent whitish text#2249
rekty wants to merge 1 commit into
XiaomiMiMo:mainfrom
rekty:fix/light-mode-font-color-win32

Conversation

@rekty

@rekty rekty commented Aug 25, 2026

Copy link
Copy Markdown

Summary

Adds a luminance guard in generateSystem() so that when the terminal foreground color is near-white (luminance > 180) in light mode, it is clamped to #1a1a1a.

Problem

When using the "system" theme in light mode on Windows Terminal, the TUI uses the terminal's native foreground color as the text color. Many Windows Terminal light themes set the foreground to near-white, making all text invisible against the light background (issue #2144).

Fix

After resolving the terminal foreground color, check its luminance in light mode. If it is too light (> 180), replace it with #1a1a1a — a safe, high-contrast dark gray. Dark mode is unaffected.

Changed: 1 file, +12/−1 (packages/opencode/src/cli/cmd/tui/context/theme.tsx)

Closes #2144

CC @MiMoHardFather @wqymi @yanyihan-xiaomi — please approve CI runs for first-time contributor. 🙏

…text

When the system theme is active in light mode, the TUI uses the terminal's
foreground color as the text color.  On Windows Terminal with light themes
the default foreground can be near-white, making text invisible against
the light background.

Add a luminance check: if the terminal foreground is too light (luminance
> 180) in light mode, clamp it to #1a1a1a so text stays readable.

Closes XiaomiMiMo#2144
@rekty

rekty commented Aug 25, 2026

Copy link
Copy Markdown
Author

Hi @MiMoHardFather @wqymi @yanyihan-xiaomi! This PR fixes invisible text in light mode on Windows Terminal. Could you please approve the CI workflow runs? Thank you! 🙏

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

windows终端上面mimo code的浅色模式字体泛白

1 participant