From 0f78f06610c0e8887aba2ae50e99b86477a384b3 Mon Sep 17 00:00:00 2001 From: Reto Brunner Date: Wed, 27 May 2020 07:37:02 +0200 Subject: Add Style configuration The following functionalities are added to configure aerc ui styles. - Read stylesets from file with very basic fnmatch wildcard matching - Add default styleset - Support different stylesets as part of UiConfig allowing contextual styles. - Move widgets/ui elements to use the stylesets. - Add configuration manual for the styleset --- widgets/selecter.go | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'widgets/selecter.go') diff --git a/widgets/selecter.go b/widgets/selecter.go index 7fae9cd..0faf37e 100644 --- a/widgets/selecter.go +++ b/widgets/selecter.go @@ -3,24 +3,27 @@ package widgets import ( "github.com/gdamore/tcell" + "git.sr.ht/~sircmpwn/aerc/config" "git.sr.ht/~sircmpwn/aerc/lib/ui" ) type Selecter struct { ui.Invalidatable - chooser bool - focused bool - focus int - options []string + chooser bool + focused bool + focus int + options []string + uiConfig config.UIConfig onChoose func(option string) onSelect func(option string) } -func NewSelecter(options []string, focus int) *Selecter { +func NewSelecter(options []string, focus int, uiConfig config.UIConfig) *Selecter { return &Selecter{ - focus: focus, - options: options, + focus: focus, + options: options, + uiConfig: uiConfig, } } @@ -34,15 +37,16 @@ func (sel *Selecter) Invalidate() { } func (sel *Selecter) Draw(ctx *ui.Context) { - ctx.Fill(0, 0, ctx.Width(), ctx.Height(), ' ', tcell.StyleDefault) + ctx.Fill(0, 0, ctx.Width(), ctx.Height(), ' ', + sel.uiConfig.GetStyle(config.STYLE_SELECTER_DEFAULT)) x := 2 for i, option := range sel.options { - style := tcell.StyleDefault + style := sel.uiConfig.GetStyle(config.STYLE_SELECTER_DEFAULT) if sel.focus == i { if sel.focused { - style = style.Reverse(true) + style = sel.uiConfig.GetStyle(config.STYLE_SELECTER_FOCUSED) } else if sel.chooser { - style = style.Bold(true) + style = sel.uiConfig.GetStyle(config.STYLE_SELECTER_CHOOSER) } } x += ctx.Printf(x, 1, style, "[%s]", option) -- cgit 1.4.1-2-gfad0 alue='search'/>
path: root/themes/headache
blob: ea5738ceabcfce83098d920561eddf49cf500add (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36