about summary refs log tree commit diff stats
path: root/widgets/dirlist.go
diff options
context:
space:
mode:
authorReto Brunner <reto@labrat.space>2020-05-27 07:37:02 +0200
committerReto Brunner <reto@labrat.space>2020-05-27 07:57:10 +0200
commit0f78f06610c0e8887aba2ae50e99b86477a384b3 (patch)
treeff4cd6581d3af0911954a37550602366d2bb0e2f /widgets/dirlist.go
parent6c4ed3cfe2fe66a1e5f26c404ea90e048142db72 (diff)
downloadaerc-0f78f06610c0e8887aba2ae50e99b86477a384b3.tar.gz
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
Diffstat (limited to 'widgets/dirlist.go')
-rw-r--r--widgets/dirlist.go12
1 files changed, 5 insertions, 7 deletions
diff --git a/widgets/dirlist.go b/widgets/dirlist.go
index 600b38c..18072fa 100644
--- a/widgets/dirlist.go
+++ b/widgets/dirlist.go
@@ -194,7 +194,8 @@ func (dirlist *DirectoryList) getRUEString(name string) string {
 }
 
 func (dirlist *DirectoryList) Draw(ctx *ui.Context) {
-	ctx.Fill(0, 0, ctx.Width(), ctx.Height(), ' ', tcell.StyleDefault)
+	ctx.Fill(0, 0, ctx.Width(), ctx.Height(), ' ',
+		dirlist.UiConfig().GetStyle(config.STYLE_DIRLIST_DEFAULT))
 
 	if dirlist.spinner.IsRunning() {
 		dirlist.spinner.Draw(ctx)
@@ -202,7 +203,7 @@ func (dirlist *DirectoryList) Draw(ctx *ui.Context) {
 	}
 
 	if len(dirlist.dirs) == 0 {
-		style := tcell.StyleDefault
+		style := dirlist.UiConfig().GetStyle(config.STYLE_DIRLIST_DEFAULT)
 		ctx.Printf(0, 0, style, dirlist.UiConfig().EmptyDirlist)
 		return
 	}
@@ -212,12 +213,9 @@ func (dirlist *DirectoryList) Draw(ctx *ui.Context) {
 		if row >= ctx.Height() {
 			break
 		}
-		style := tcell.StyleDefault
+		style := dirlist.UiConfig().GetStyle(config.STYLE_DIRLIST_DEFAULT)
 		if name == dirlist.selected {
-			style = style.Reverse(true)
-		} else if name == dirlist.selecting {
-			style = style.Reverse(true)
-			style = style.Foreground(tcell.ColorGray)
+			style = dirlist.UiConfig().GetStyleSelected(config.STYLE_DIRLIST_DEFAULT)
 		}
 		ctx.Fill(0, row, ctx.Width(), 1, ' ', style)