[GH-ISSUE #514] Textview: non-dynamic background color #373

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

Originally created by @tjmtmmnk on GitHub (Oct 14, 2020).
Original GitHub issue: https://github.com/rivo/tview/issues/514

Hi, Thank you for a wonderful library!

I want the background color to be fixed when using Textview with SetDynamicColors set to true.

For example, if the terminal's background color is not white or black, running an external command like the bat command with color=always and TranslateANSI to display it.

スクリーンショット 2020-10-15 0 44 27

Please let me know what you think about my request.

Originally created by @tjmtmmnk on GitHub (Oct 14, 2020). Original GitHub issue: https://github.com/rivo/tview/issues/514 Hi, Thank you for a wonderful library! I want the background color to be fixed when using Textview with `SetDynamicColors` set to true. For example, if the terminal's background color is not white or black, running an external command like the `bat` command with `color=always` and `TranslateANSI` to display it. <img width="357" alt="スクリーンショット 2020-10-15 0 44 27" src="https://user-images.githubusercontent.com/31027514/96012918-a2ce5a00-0e7f-11eb-9861-f1cb2be7b52c.png"> Please let me know what you think about my request.
kerem closed this issue 2026-03-04 01:04:27 +03:00
Author
Owner

@rivo commented on GitHub (Nov 18, 2020):

I'm not completely sure I understand. Does the screenshot show tview with bat's output piped into it using TranslateANSI? And if so, do you want these grey bars or don't you want them?

<!-- gh-comment-id:729583246 --> @rivo commented on GitHub (Nov 18, 2020): I'm not completely sure I understand. Does the screenshot show `tview` with `bat`'s output piped into it using `TranslateANSI`? And if so, do you want these grey bars or don't you want them?
Author
Owner

@tjmtmmnk commented on GitHub (Nov 18, 2020):

I’m sorry I was misunderstanding.

I thought the terminal background color was reflected in the result when I run bat command with --color=always, which was wrong.
Actually, only the foreground color was specified and the background color was not specified.

It was gray because the background color (bat result) was not set and the background color of the terminal was reflected.

Setting the TextView background color to tcell.ColorDefault used the terminal background color (https://github.com/rivo/tview/blob/master/box.go#L337), which solved this problem.

<!-- gh-comment-id:729862485 --> @tjmtmmnk commented on GitHub (Nov 18, 2020): I’m sorry I was misunderstanding. I thought the terminal background color was reflected in the result when I run `bat` command with `--color=always`, which was wrong. Actually, only the foreground color was specified and the background color was not specified. It was gray because the background color (`bat` result) was not set and the background color of the terminal was reflected. Setting the `TextView` background color to `tcell.ColorDefault` used the terminal background color (https://github.com/rivo/tview/blob/master/box.go#L337), which solved this problem.
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#373
No description provided.