Text selection has poor contrast/readability on light terminals with certain themes #3432

Open
opened 2026-02-16 17:40:03 -05:00 by yindo · 3 comments
Owner

Originally created by @ben-vargas on GitHub (Dec 9, 2025).

Originally assigned to: @kommander on GitHub.

Description

When selecting text (mouse drag to copy) in the TUI on a light terminal, the selection highlighting has poor contrast making the selected text difficult or impossible to read. This affects the default opencode theme, as well as orng and likely others.

The root cause is that @opentui/core defaults to inverting foreground/background colors when no explicit selection colors are provided. This works well for dark themes (light text → light selection background with dark text), but produces poor results for light themes or themes with dark text colors (dark text → dark selection background with black/transparent foreground).

OpenCode version

1.0.137

Steps to reproduce

  1. Use a light terminal theme (or terminal with light background)
  2. Run opencode with the default opencode theme (also reproducible with orng and others)
  3. Have the AI generate a response with some text
  4. Try to select text by clicking and dragging to copy it
  5. Notice the selection is hard to read due to poor contrast

Screenshot and/or share link

Image Image

Operating System

macOS (likely affects all platforms)

Terminal

Ghostty

Originally created by @ben-vargas on GitHub (Dec 9, 2025). Originally assigned to: @kommander on GitHub. ### Description When selecting text (mouse drag to copy) in the TUI on a light terminal, the selection highlighting has poor contrast making the selected text difficult or impossible to read. This affects the default `opencode` theme, as well as `orng` and likely others. The root cause is that `@opentui/core` defaults to inverting foreground/background colors when no explicit selection colors are provided. This works well for dark themes (light text → light selection background with dark text), but produces poor results for light themes or themes with dark text colors (dark text → dark selection background with black/transparent foreground). ### OpenCode version 1.0.137 ### Steps to reproduce 1. Use a light terminal theme (or terminal with light background) 2. Run opencode with the default `opencode` theme (also reproducible with `orng` and others) 3. Have the AI generate a response with some text 4. Try to select text by clicking and dragging to copy it 5. Notice the selection is hard to read due to poor contrast ### Screenshot and/or share link <img width="3001" height="2494" alt="Image" src="https://github.com/user-attachments/assets/057082fb-f94e-44e1-a250-873ce9a27a5c" /> <img width="3005" height="919" alt="Image" src="https://github.com/user-attachments/assets/80ebe1f8-fb33-4c0f-b85c-366b9133fcc7" /> ### Operating System macOS (likely affects all platforms) ### Terminal Ghostty
yindo added the opentui label 2026-02-16 17:40:03 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Dec 9, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #4669: Bug: Highlighted text invisible with transparent custom themes
  • #4666: Bug: Highlighted text invisible with transparent custom themes
  • #4427: System theme (regressed selection visibility in 1.0.69)

These issues also report contrast and readability problems with text selection highlighting in the TUI when using certain themes, particularly with light terminals or transparent backgrounds. Feel free to ignore if your specific case differs from these reports.

@github-actions[bot] commented on GitHub (Dec 9, 2025): This issue might be a duplicate of existing issues. Please check: - #4669: Bug: Highlighted text invisible with transparent custom themes - #4666: Bug: Highlighted text invisible with transparent custom themes - #4427: System theme (regressed selection visibility in 1.0.69) These issues also report contrast and readability problems with text selection highlighting in the TUI when using certain themes, particularly with light terminals or transparent backgrounds. Feel free to ignore if your specific case differs from these reports.
Author
Owner

@ben-vargas commented on GitHub (Dec 9, 2025):

I had checked #4669 and #4666 noted above by github-actions bot but those seem to be about (slash) command highlighting rather than selecting text on the scrollback buffer components.

@ben-vargas commented on GitHub (Dec 9, 2025): I had checked #4669 and #4666 noted above by github-actions bot but those seem to be about (slash) command highlighting rather than selecting text on the scrollback buffer components.
Author
Owner

@kommander commented on GitHub (Dec 20, 2025):

It needs to set proper text selection fg/bg colors and add these to the theme, as by default it currently just inverses the colors.

@kommander commented on GitHub (Dec 20, 2025): It needs to set proper text selection fg/bg colors and add these to the theme, as by default it currently just inverses the colors.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3432