opencode icon indicating copy to clipboard operation
opencode copied to clipboard

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

Open ben-vargas opened this issue 2 weeks ago • 2 comments

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

ben-vargas avatar Dec 09 '25 21:12 ben-vargas

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] avatar Dec 09 '25 21:12 github-actions[bot]

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 avatar Dec 09 '25 21:12 ben-vargas