mirror of
https://github.com/rivo/tview.git
synced 2026-04-26 21:35:54 +03:00
[GH-ISSUE #934] More precise view customization of selected table cells #683
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#683
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @vlanse on GitHub (Jan 7, 2024).
Original GitHub issue: https://github.com/rivo/tview/issues/934
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.
@rivo commented on GitHub (Apr 4, 2024):
Can you provide an example where reverting the colours gives unpleasant results?
@vlanse commented on GitHub (Apr 4, 2024):
Sure, here it is. IMO the selected line (
45) is not even readable: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
45selected below):Best solution IMO would be to add underline style to selected row w/o changing the other styles.
@rivo commented on GitHub (Apr 6, 2024):
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.ColorDefaulthere (or anywhere, for that matter). In your example, set it totcell.ColorBlack. That's the default already so you don't really have to set anything here anyway.@rivo commented on GitHub (Apr 6, 2024):
But in any case, the latest commit introduces individual styling for selected cells.