[GH-ISSUE #611] Would be nice to expose tcell.Style directly #450

Closed
opened 2026-03-04 01:05:06 +03:00 by kerem · 3 comments
Owner

Originally created by @gdamore on GitHub (May 28, 2021).
Original GitHub issue: https://github.com/rivo/tview/issues/611

Many of the widgets here use tcell styles, but the tview API only exposes the Color explicitly. This leads to inconsistencies in some places. For example, the border can usually have attributes set on it, but other things can't. Some things can have their background color changed, and others can't.

I have a use case where I'd like to be able to provide underlining via attributes to things (basically I want to use List with colors and an underbar to make it look like sort of like hyperlinks).

It turns out that making Attributes available everywhere is also possibly very important, because in some settings we are not permitted to use color exclusively to convey meaning. (Due to color blindness). Using attributes would let us change the way the text is rendered to add underbars, reverse text (which can be simulated with colors), blink, italics, etc.

Essentially, I'd like every widget to have methods:

SetStyle(), SetBorderStyle(), SetTitleStyle(), etc.

Originally created by @gdamore on GitHub (May 28, 2021). Original GitHub issue: https://github.com/rivo/tview/issues/611 Many of the widgets here use tcell styles, but the tview API only exposes the Color explicitly. This leads to inconsistencies in some places. For example, the border can usually have attributes set on it, but other things can't. Some things can have their background color changed, and others can't. I have a use case where I'd like to be able to provide underlining via attributes to things (basically I want to use List with colors and an underbar to make it look like sort of like hyperlinks). It turns out that making Attributes available everywhere is also possibly very important, because in some settings we are not permitted to use color exclusively to convey meaning. (Due to color blindness). Using attributes would let us change the way the text is rendered to add underbars, reverse text (which *can* be simulated with colors), blink, italics, etc. Essentially, I'd like *every* widget to have methods: SetStyle(), SetBorderStyle(), SetTitleStyle(), etc.
kerem closed this issue 2026-03-04 01:05:07 +03:00
Author
Owner

@rivo commented on GitHub (May 29, 2021):

It's just a historical artifact that tview uses Color more than Style. I guess when I started the project, I thought colours would be all people needed. But I was obviously wrong.

I can look into adding additional functions to set styles. But it has to be backwards compatible.

<!-- gh-comment-id:850805470 --> @rivo commented on GitHub (May 29, 2021): It's just a historical artifact that `tview` uses `Color` more than `Style`. I guess when I started the project, I thought colours would be all people needed. But I was obviously wrong. I can look into adding additional functions to set styles. But it has to be backwards compatible.
Author
Owner

@golangdojo99 commented on GitHub (Sep 27, 2022):

+1

<!-- gh-comment-id:1259222904 --> @golangdojo99 commented on GitHub (Sep 27, 2022): +1
Author
Owner

@rivo commented on GitHub (Dec 12, 2022):

I'm closing this as there's no need to track this issue anymore. I have added a lot of methods to set/get the tcell.Style object directly already and continue to add them where they are still missing.

<!-- gh-comment-id:1346703648 --> @rivo commented on GitHub (Dec 12, 2022): I'm closing this as there's no need to track this issue anymore. I have added a lot of methods to set/get the `tcell.Style` object directly already and continue to add them where they are still missing.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tview#450
No description provided.