[GH-ISSUE #730] Random background color #534

Closed
opened 2026-03-04 01:05:48 +03:00 by kerem · 1 comment
Owner

Originally created by @lopqto on GitHub (May 6, 2022).
Original GitHub issue: https://github.com/rivo/tview/issues/730

Hey folks,
I'm developing an app that uses tview. To manage widgets, I used Grids. There is a minor issue with setting the background color. No matter what I develop, it always selects some random color from the user's terminal.

Terminator:
image

  • My terminal's background color is black. I don't know where the gray one came from!

Alacrity:
image

I tried this one before, and it does nothing:

appGrid.SetBackgroundColor(tcell.ColorBlack)

And sometimes, by opening another page, it goes crazy:
image

I use SetRoot to switch pages:

NextButton := tview.NewButton("Next").SetSelectedFunc(func() {
		app.SetRoot(stepThree(app), false)
	})

How can I handle this background situation?

Thanks, everybody!

Originally created by @lopqto on GitHub (May 6, 2022). Original GitHub issue: https://github.com/rivo/tview/issues/730 Hey folks, I'm developing an app that uses tview. To manage widgets, I used `Grids`. There is a minor issue with setting the background color. No matter what I develop, it always selects some random color from the user's terminal. Terminator: ![image](https://user-images.githubusercontent.com/30213943/167133055-9c14cb3f-f5b3-4d3f-9587-66f938881158.png) * My terminal's background color is black. I don't know where the gray one came from! Alacrity: ![image](https://user-images.githubusercontent.com/30213943/167133112-faff054a-59ed-40e5-9367-6ec253e696b6.png) I tried this one before, and it does nothing: ``` Go appGrid.SetBackgroundColor(tcell.ColorBlack) ``` And sometimes, by opening another page, it goes crazy: ![image](https://user-images.githubusercontent.com/30213943/167133575-eeb19168-9129-4d3b-aa4f-d7400e8b0ef3.png) I use `SetRoot` to switch pages: ``` Go NextButton := tview.NewButton("Next").SetSelectedFunc(func() { app.SetRoot(stepThree(app), false) }) ``` How can I handle this background situation? Thanks, everybody!
kerem closed this issue 2026-03-04 01:05:48 +03:00
Author
Owner

@rivo commented on GitHub (Jun 10, 2022):

Are you using tcell.ColorDefault somewhere? (If you are, you shouldn't.)

It's difficult to look into this without being able to reproduce this. Can you post some short code I can run which creates this effect?

<!-- gh-comment-id:1152528355 --> @rivo commented on GitHub (Jun 10, 2022): Are you using `tcell.ColorDefault` somewhere? (If you are, you shouldn't.) It's difficult to look into this without being able to reproduce this. Can you post some short code I can run which creates this effect?
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#534
No description provided.