~sircmpwn/aerc

Configure color for unseen messages v1 PROPOSED

Sorry, but we're going to address theming as a whole separate thing.
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sircmpwn/aerc/%3C20191007195727.22371-1-user%40perona%3E/mbox | git am -3
Learn more about email & git

[PATCH] Configure color for unseen messages Export this patch

From: jfhaecker <jfhaecker@gmail.com>

Adds a config option "message-color-unseen" in UI section for setting
color of unseen messages.
---
 config/config.go      |  2 ++
 doc/aerc-config.5.scd |  4 ++++
 widgets/msglist.go    | 10 ++++++++++
 3 files changed, 16 insertions(+)

diff --git a/config/config.go b/config/config.go
index 133a7f4..42a6e0e 100644
--- a/config/config.go
+++ b/config/config.go
@@ -38,6 +38,7 @@ type UIConfig struct {
 	DirListFormat       string   `ini:"dirlist-format"`
 	Sort                []string `delim:" "`
 	NextMessageOnDelete bool     `ini:"next-message-on-delete"`
+	MessageColorUnseen  string   `ini:"message-color-unseen"`
 }
 
 const (
@@ -358,6 +359,7 @@ func LoadConfigFromFile(root *string, sharedir string) (*AercConfig, error) {
 			SpinnerDelimiter:    ",",
 			DirListFormat:       "%n %>r",
 			NextMessageOnDelete: true,
+			MessageColorUnseen:  "",
 		},
 
 		Viewer: ViewerConfig{
diff --git a/doc/aerc-config.5.scd b/doc/aerc-config.5.scd
index f4f02f2..8f09452 100644
--- a/doc/aerc-config.5.scd
+++ b/doc/aerc-config.5.scd
@@ -155,6 +155,10 @@ These options are configured in the *[ui]* section of aerc.conf.
 
 	Default: true
 
+*message-color-unseen*
+	Color for unseen messages
+
+	Default: ""
 ## VIEWER
 
 These options are configured in the *[viewer]* section of aerc.conf.
diff --git a/widgets/msglist.go b/widgets/msglist.go
index 5c2d2f4..59f1251 100644
--- a/widgets/msglist.go
+++ b/widgets/msglist.go
@@ -101,8 +101,18 @@ func (ml *MessageList) Draw(ctx *ui.Context) {
 				seen = true
 			}
 		}
+
 		if !seen {
 			style = style.Bold(true)
+			foregroundColor := ml.conf.Ui.MessageColorUnseen
+			if len(foregroundColor) > 0 {
+				color, exists := tcell.ColorNames[foregroundColor]
+				if exists {
+					style = style.Foreground(color)
+				} else {
+					ml.logger.Printf("Unkown color: [%s]", foregroundColor)
+				}
+			}
 		}
 
 		ctx.Fill(0, row, ctx.Width(), 1, ' ', style)
-- 
2.17.1
Sorry, but we're going to address theming as a whole separate thing.
View this thread in the archives