Skip to content

feat: use theme colors for visual and copy mode selections#83

Merged
leohenon merged 3 commits intoleohenon:ocvfrom
reobin:feat/visual-colors
May 1, 2026
Merged

feat: use theme colors for visual and copy mode selections#83
leohenon merged 3 commits intoleohenon:ocvfrom
reobin:feat/visual-colors

Conversation

@reobin
Copy link
Copy Markdown

@reobin reobin commented Apr 29, 2026

  • make visual mode a bit more vim-like
  • cursor doesn't change color between normal and visual modes
  • selected text in visual mode uses a different background than cursor (secondary)
  • extract CopyOverlay to share overlay rendering across messages

* make visual mode a bit more vim-like
* cursor doesn't change color between normal and visual modes
* selected text in visual mode uses a different background than cursor
* extract CopyOverlay to share overlay rendering across messages
@leohenon
Copy link
Copy Markdown
Owner

Nice improvements! Showing the character under the cursor is useful.

Only thing I see is that in copy mode, the character under the cursor always stays readable, but in prompt
visual mode it can become unreadable on certain dark themes (eg: Vesper, default).

Looks like copy mode renders the cursor with a contrast-aware foreground:

selectedForeground(theme, theme.text)

but prompt visual mode hardcodes the cursor cell to theme.text on theme.backgroundElement.

Can we make prompt visual mode use the same contrast-aware cursor colors as copy mode?

@reobin
Copy link
Copy Markdown
Author

reobin commented Apr 29, 2026

I don't personally have the issue you mentioned, but did make some changes that should fix it for you. would you mind trying again?

@leohenon
Copy link
Copy Markdown
Owner

leohenon commented May 1, 2026

Interesting that you didn't see it, likely depends on how your terminal overlays the cursor on the cell.

Your approach was close, but it didn't fully fix it for me, so I updated it to match copy mode exactly. looks good now.

I was unsure at first about using themed selection instead of opencodes white/inverted, since it could look odd in some themes and inconsistent with the mouse. But I also think it makes sense here because it separates mouse selection from vim visual so let’s try it.

@leohenon leohenon merged commit 0f7f824 into leohenon:ocv May 1, 2026
2 checks passed
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.

2 participants