mirror of
https://github.com/rivo/tview.git
synced 2026-04-27 13:55:51 +03:00
[GH-ISSUE #904] Dropdown List: Default Background Color is Immutable! #660
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#660
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @WhipMeHarder on GitHub (Oct 26, 2023).
Original GitHub issue: https://github.com/rivo/tview/issues/904
In the example of your Dropdown List, the colors for all objects can be changed, except for the default "green" background color of the Dropdown List.
For example, with the default code, I have modified it to this: -
app := tview.NewApplication() dropdown := tview.NewDropDown(). SetLabel("Choose the service that you want: (hit Enter): "). SetLabelColor(tcell.ColorBlue). SetFieldBackgroundColor(tcell.ColorRed). SetFieldTextColor(tcell.ColorBlue). SetPrefixTextColor(tcell.ColorYellow). SetOptions([]string{" First", " Second ", " Third", " Fourth ", " Fifth"}, nil) if err := app.SetRoot(dropdown, true).SetFocus(dropdown).Run(); err != nil { panic(err) }Would you be willing to add a function such as: -
Under "type DropDown", so that the code would look like this: -
app := tview.NewApplication() dropdown := tview.NewDropDown(). SetLabel("Choose the service that you want: (hit Enter): "). SetDropdownBackgroundColor(tcell.ColorBlue). SetOptions([]string{" First", " Second ", " Third", " Fourth ", " Fifth"}, nil) if err := app.SetRoot(dropdown, true).SetFocus(dropdown).Run(); err != nil { panic(err) }Many thanks,
WhipMeHarder
@rivo commented on GitHub (Oct 26, 2023):
Such a function already exists. See
SetListStyles().@WhipMeHarder commented on GitHub (Oct 29, 2023):
Thank you! I was just going to be rude and ask you if you could give me a code example of "SetListStyles", when I came across a link here:
https://github.com/rivo/tview/blob/8b7bcf9883df/dropdown.go#L210
WhipMeHarder