[GH-ISSUE #270] SetBackgroundColor(-1) issue #209

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

Originally created by @eu81273 on GitHub (Apr 18, 2019).
Original GitHub issue: https://github.com/rivo/tview/issues/270

To match the background color with the terminal system background color, must set the SetBackgroundColor value to -1(tcell.ColorDefault).

Setting the BackgroundColor to -1 is works fine for most components, but for the List component produces unexpected results like below...

  • When the list is updated, the updated list and the previous list are overlapped.
  • When move the cursor down, the previous item remains in the selected background color.
Originally created by @eu81273 on GitHub (Apr 18, 2019). Original GitHub issue: https://github.com/rivo/tview/issues/270 To match the background color with the terminal system background color, must set the SetBackgroundColor value to -1(tcell.ColorDefault). Setting the BackgroundColor to -1 is works fine for most components, but for the List component produces unexpected results like below... - When the list is updated, the updated list and the previous list are overlapped. - When move the cursor down, the previous item remains in the selected background color.
kerem closed this issue 2026-03-04 01:03:00 +03:00
Author
Owner

@diamondburned commented on GitHub (Apr 20, 2019):

Try

	app := tview.NewApplication()
	defer app.Stop()

	app.SetBeforeDrawFunc(func(s tcell.Screen) bool {
		s.Clear()
		return false
	})
<!-- gh-comment-id:485083503 --> @diamondburned commented on GitHub (Apr 20, 2019): Try ```go app := tview.NewApplication() defer app.Stop() app.SetBeforeDrawFunc(func(s tcell.Screen) bool { s.Clear() return false }) ```
Author
Owner

@eu81273 commented on GitHub (Apr 22, 2019):

@diamondburned
Thank you. SetBeforeDrawFunc works perfect.

<!-- gh-comment-id:485335638 --> @eu81273 commented on GitHub (Apr 22, 2019): @diamondburned Thank you. SetBeforeDrawFunc works perfect.
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#209
No description provided.