rivo / tview

Terminal UI library with rich, interactive widgets — written in Golang

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

More precise view customization of selected table cells

vlanse opened this issue · comments

Currently selected style could by only set "globally" for table, so it overrides cell style completely when it is selected. There are cases when this such behavior is not ok, e.g. when content of table cells is displayed with different colors of cells depending on some params. When such a row with different cell colors is selected now, color differentiation is removed completely

I know that when selection style is not set, colors are "reverted", but this approach gives visually unpleasant results, at least in some cases.

Suggestion is to allow per-cell customization of appearance of selected cells, so selected style could be (optionally) set on a per-cell basis.

commented

Can you provide an example where reverting the colours gives unpleasant results?

Sure, here it is. IMO the selected line (45) is not even readable:

Screenshot 2024-04-04 at 21 22 37

What I want is just to add the underline style to the selected row, but right now it could not be achieved, as you can see below, the color differentiation between the cells is lost (same line 45 selected below):

Screenshot 2024-04-04 at 21 17 31

Best solution IMO would be to add underline style to selected row w/o changing the other styles.

commented

It seems to me that you're setting the cell's background colour to tcell.ColorDefault. And your default terminal color is some kind of grey. So swapping the colours leads to the background colour to be red (or green) and the foreground colour to be grey. Yes, that leads to low contrast.

I would suggest not to use tcell.ColorDefault here (or anywhere, for that matter). In your example, set it to tcell.ColorBlack. That's the default already so you don't really have to set anything here anyway.

commented

But in any case, the latest commit introduces individual styling for selected cells.