[GH-ISSUE #35] TableCell is not honoring Styles.PrimitiveBackgroundColor #26

Closed
opened 2026-03-04 01:01:13 +03:00 by kerem · 4 comments
Owner

Originally created by @dpotapov on GitHub (Jan 18, 2018).
Original GitHub issue: https://github.com/rivo/tview/issues/35

Hi,

Table cells are displayed with black background color by default. I think they should honor Styles.PrimitiveBackgroundColor setting.
table

Originally created by @dpotapov on GitHub (Jan 18, 2018). Original GitHub issue: https://github.com/rivo/tview/issues/35 Hi, Table cells are displayed with black background color by default. I think they should honor `Styles.PrimitiveBackgroundColor` setting. ![table](https://user-images.githubusercontent.com/5475708/35111278-88029e42-fc40-11e7-8805-f4e761209f42.png)
kerem closed this issue 2026-03-04 01:01:14 +03:00
Author
Owner

@rivo commented on GitHub (Jan 19, 2018):

The nil value of tcell.Color is black. So since I introduced individual cell background colors, if you don't want to specify the background color for all cells, you now have to use the NewTableCell() constructor instead of instancing the TableCell type directly. The constructor will set the background color to tcell.ColorDefault which is transparent and the text color to Styles.PrimaryTextColor.

See also the documentation here.

<!-- gh-comment-id:358885860 --> @rivo commented on GitHub (Jan 19, 2018): The nil value of `tcell.Color` is black. So since I introduced individual cell background colors, if you don't want to specify the background color for all cells, you now have to use the `NewTableCell()` constructor instead of instancing the `TableCell` type directly. The constructor will set the background color to `tcell.ColorDefault` which is transparent and the text color to `Styles.PrimaryTextColor`. See also the documentation [here](https://godoc.org/github.com/rivo/tview#TableCell).
Author
Owner

@dpotapov commented on GitHub (Jan 19, 2018):

@rivo would it make sense to call the cell constructor from SetCellSimple() method?

<!-- gh-comment-id:359115213 --> @dpotapov commented on GitHub (Jan 19, 2018): @rivo would it make sense to call the cell constructor from `SetCellSimple()` method?
Author
Owner

@rivo commented on GitHub (Jan 20, 2018):

Definitely! This was an oversight. Thanks for the hint. It's fixed now.

<!-- gh-comment-id:359177351 --> @rivo commented on GitHub (Jan 20, 2018): Definitely! This was an oversight. Thanks for the hint. It's fixed now.
Author
Owner

@dpotapov commented on GitHub (Jan 20, 2018):

Great! thanks a lot!

<!-- gh-comment-id:359178641 --> @dpotapov commented on GitHub (Jan 20, 2018): Great! thanks a lot!
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#26
No description provided.