[PR #5387] fix(tui): ensure fatal error UI is readable in light mode #11376

Closed
opened 2026-02-16 18:16:12 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/5387

State: closed
Merged: Yes


Fixes invisible text in the fatal error screen on light terminals by making the error fallback mode-aware and applying explicit foreground/background colors.

Similar to #5352 and #5378, but unlike them, the fatal fallback cannot depend on the theme context, since the ErrorBoundary wraps ThemeProvider. Without explicit fg, the renderer defaults to white text (probably the OpenTUI default), causing white-on-white invisibility in light terminals.

Changes

  • Pass precomputed mode into ErrorBoundary fallback
  • Make ErrorComponent accept mode?: "dark" | "light" and use explicit fg/backgroundColor with safe light/dark fallback colors derived from the opencode palette (replaced hardcoded #565f89 button color with it as well)
  • Apply the colors to the fatal error message elements

Notes

There are two main stylistic choices, and I would like the maintainers to modify the code as needed. This PR strictly fixes the visibility bug in light mode.

  1. Panel background: This PR sets an explicit backgroundColor on the error panel to guarantee contrast. Alternative: remove it to use the terminal's native background (may compromise readability depending on the terminal's background color). The current codebase is using the terminal's background.
  2. Color approach: This PR uses dynamic dark/light colors based on terminal mode. Alternative: force a dark background with light text regardless of mode (simpler/more robust, but worse UX for light-terminal users).

Examples

I added a mock throw error to check the fatal error screen.

Before (light)
image

After (light)
image

Before (dark)
image

After (dark)
image

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/5387 **State:** closed **Merged:** Yes --- Fixes invisible text in the fatal error screen on light terminals by making the error fallback mode-aware and applying explicit foreground/background colors. Similar to #5352 and #5378, but unlike them, the fatal fallback cannot depend on the theme context, since the ErrorBoundary wraps ThemeProvider. Without explicit fg, the renderer defaults to white text (probably the OpenTUI default), causing white-on-white invisibility in light terminals. ## Changes - Pass precomputed mode into ErrorBoundary fallback - Make ErrorComponent accept mode?: "dark" | "light" and use explicit fg/backgroundColor with safe light/dark fallback colors derived from the opencode palette (replaced hardcoded #565f89 button color with it as well) - Apply the colors to the fatal error message elements ## Notes There are two main stylistic choices, and I would like the maintainers to modify the code as needed. This PR strictly fixes the visibility bug in light mode. 1. Panel background: This PR sets an explicit backgroundColor on the error panel to guarantee contrast. Alternative: remove it to use the terminal's native background (may compromise readability depending on the terminal's background color). The current codebase is using the terminal's background. 2. Color approach: This PR uses dynamic dark/light colors based on terminal mode. Alternative: force a dark background with light text regardless of mode (simpler/more robust, but worse UX for light-terminal users). ## Examples I added a mock throw error to check the fatal error screen. Before (light) <img width="3360" height="2100" alt="image" src="https://github.com/user-attachments/assets/3072fd67-b761-412b-8b00-15fdd8fb7491" /> After (light) <img width="3360" height="2100" alt="image" src="https://github.com/user-attachments/assets/9cdf34c3-9612-4611-9c4b-862cfec3c442" /> Before (dark) <img width="3360" height="2100" alt="image" src="https://github.com/user-attachments/assets/e179f7f4-1de5-4f33-a033-b43cfe78c53b" /> After (dark) <img width="3360" height="2100" alt="image" src="https://github.com/user-attachments/assets/f48d245c-edbe-48d3-a610-7483ef9b2832" />
yindo added the pull-request label 2026-02-16 18:16:12 -05:00
yindo closed this issue 2026-02-16 18:16:12 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#11376