From 1b4492016732e1529cad84a560114abe8fdde242 Mon Sep 17 00:00:00 2001 From: Andreas Bieber Date: Wed, 16 Sep 2020 16:33:38 +0200 Subject: [PATCH] feat(dropdown): Add setters for dropdown list colors --- dropdown.go | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/dropdown.go b/dropdown.go index ee8c01a..d3d0a07 100644 --- a/dropdown.go +++ b/dropdown.go @@ -268,6 +268,42 @@ func (d *DropDown) SetFieldTextColorFocused(color tcell.Color) *DropDown { return d } +// SetDropDownTextColor sets text color of the drop down list. +func (d *DropDown) SetDropDownTextColor(color tcell.Color) *DropDown { + d.Lock() + defer d.Unlock() + + d.list.SetMainTextColor(color) + return d +} + +// SetDropDownBackgroundColor sets the background color of the drop list. +func (d *DropDown) SetDropDownBackgroundColor(color tcell.Color) *DropDown { + d.Lock() + defer d.Unlock() + + d.list.SetBackgroundColor(color) + return d +} + +// The text color of the selected option in the drop down list. +func (d *DropDown) SetDropDownSelectedTextColor(color tcell.Color) *DropDown { + d.Lock() + defer d.Unlock() + + d.list.SetSelectedTextColor(color) + return d +} + +// The background color of the selected option in the drop down list. +func (d *DropDown) SetDropDownSelectedBackgroundColor(color tcell.Color) *DropDown { + d.Lock() + defer d.Unlock() + + d.list.SetSelectedBackgroundColor(color) + return d +} + // SetPrefixTextColor sets the color of the prefix string. The prefix string is // shown when the user starts typing text, which directly selects the first // option that starts with the typed string.