sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit ad1f418ae38b3b9be87536cef68bbcee963e1134
parent 7e2bb889e617302c82e28d04cb2e0db5d35fbb08
Author: Matías Aguirre <matiasaguirre@gmail.com>
Date:   Tue, 25 Jan 2011 00:54:16 -0200

Custom label coloring

Diffstat:
M lib/sup/colormap.rb | 4 ++++
M lib/sup/modes/thread-index-mode.rb | 4 +++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/lib/sup/colormap.rb b/lib/sup/colormap.rb
@@ -176,6 +176,10 @@ class Colormap
     color
   end
 
+  def sym_is_defined sym
+      return sym if @entries.member? sym
+  end
+
   ## Try to use the user defined colors, in case of an error fall back
   ## to the default ones.
   def populate_colormap
diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb
@@ -893,7 +893,9 @@ protected
       [:to_me_color, t.labels.member?(:attachment) ? "@" : " "],
       [:to_me_color, dp ? ">" : (p ? '+' : " ")],
     ] +
-      (t.labels - @hidden_labels).map { |label| [:label_color, "#{label} "] } +
+      (t.labels - @hidden_labels).map {
+            |label| [Colormap.sym_is_defined("label_#{label}_color".to_sym) || :label_color, "#{label} "]
+      } +
       [
       [subj_color, t.subj + (t.subj.empty? ? "" : " ")],
       [:snippet_color, t.snippet],