fix(tui): clamp terminal foreground in light mode to prevent whitish text - #2249
Open
rekty wants to merge 1 commit into
Open
fix(tui): clamp terminal foreground in light mode to prevent whitish text#2249rekty wants to merge 1 commit into
rekty wants to merge 1 commit into
Conversation
…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
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! 🙏 |
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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. 🙏