tview icon indicating copy to clipboard operation
tview copied to clipboard

Always fill Box background

Open tslocum opened this issue 5 years ago • 5 comments

This resolves rendering issues with TextViews which have their background color set to ColorDefault.

tslocum avatar Jan 28 '20 15:01 tslocum

Without this change, when setting the content of a TextView with its background set to ColorDefault to a shorter length than it previously was, anywhere not drawn upon with new text will continue displaying the previous text.

tslocum avatar Jan 28 '20 15:01 tslocum

Can you give an example where ColorDefault is a good idea for the background colour of a TextView?

rivo avatar Feb 19 '20 20:02 rivo

Setting the foreground and background to ColorDefault allows the usage of users' default terminal colors. Filling with a solid color instead may affect terminal transparency (Alacritty+Linux) and/or not combine aesthetically with users' terminal colors, as they are unknown. It's best to have a choice of whether or not to specify a set of colors to use, which this PR allows. Using the colors chosen by the user is simple:

tview.Styles.TitleColor = tcell.ColorDefault
tview.Styles.BorderColor = tcell.ColorDefault
tview.Styles.PrimaryTextColor = tcell.ColorDefault
tview.Styles.PrimitiveBackgroundColor = tcell.ColorDefault

tslocum avatar Feb 20 '20 00:02 tslocum

I also have this issue, where I want the background to use ColorDefault to have a semi transparent background, but then it won't update those portions of the widget.

ajisaac avatar Mar 01 '20 05:03 ajisaac

Also hit this issue, with the same motivation as @tslocum : the tui we're building ( https://github.com/zrepl/zrepl/pull/297 ) is monochromatic and thus we want to use the user's default terminal emulator colors. The effect for the end user is that the tui feels like it automatically respects the user's preference for light / dark terminal emulator theme.

problame avatar Feb 20 '21 21:02 problame