Added own implementation of SetBackgroundColor() to TextView, to keep backwards compatibility. Fixes #777

This commit is contained in:
Oliver 2022-12-11 17:09:34 +01:00
parent e6cd7110ac
commit 55d1ca9d33
2 changed files with 9 additions and 0 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 57 KiB

View File

@ -376,6 +376,15 @@ func (t *TextView) SetTextColor(color tcell.Color) *TextView {
return t
}
// SetBackgroundColor overrides its implementation in Box to set the background
// color of this primitive. For backwards compatibility reasons, it also sets
// the background color of the main text element.
func (t *TextView) SetBackgroundColor(color tcell.Color) *Box {
t.Box.SetBackgroundColor(color)
t.textStyle = t.textStyle.Background(color)
return t.Box
}
// SetTextStyle sets the initial style of the text (which can be changed
// dynamically by sending color strings in square brackets to the text view if
// dynamic colors are enabled). This style's background color also determines