Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SetBackgroundColor doesn't work on Box #1033

Open
ardawan opened this issue Oct 10, 2024 · 1 comment
Open

SetBackgroundColor doesn't work on Box #1033

ardawan opened this issue Oct 10, 2024 · 1 comment

Comments

@ardawan
Copy link

ardawan commented Oct 10, 2024

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?

@rivo
Copy link
Owner

rivo commented Oct 16, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants