tview icon indicating copy to clipboard operation
tview copied to clipboard

SetBackgroundColor doesn't work on Box

Open ardawan opened this issue 1 year ago • 1 comments

I'm not sure if this is a bug or I'm not familiar with this package. Understand that each Flex type has a *Box as mentioned in the doc.

type Flex struct {
	*Box

	// The items to be positioned.
	items []*flexItem

	// FlexRow or FlexColumn.
	direction int

	// If set to true, Flex will use the entire screen as its available space
	// instead its box dimensions.
	fullScreen bool
}

But when I try to set the background color for the box, nothing will change.

f := tview.NewFlex().SetDirection(tview.FlexRow)
f.Box.SetBackgroundColor(tcell.ColorGreen)

So the question is how can we set a background color for the whole flex primitive?

ardawan avatar Oct 10 '24 14:10 ardawan

Container primitives such as Flex or Grid don't clear the screen they occupy. So the background colour is ignored. One of the reasons is that they are used to position other elements on the screen. See for example the Wiki: https://github.com/rivo/tview/wiki/Modal

rivo avatar Oct 16 '24 19:10 rivo