sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit b5b0413e891dcb81460450e8ca96ac6506c3dada
parent 5b5d437acfcf751d07569e504e5904c5ee6f4758
Author: Michael Stapelberg <michael@stapelberg.de>
Date:   Wed, 26 Jan 2011 21:19:12 +0100

Merge branch 'label-colors' into next

Diffstat:
M lib/sup/colormap.rb | 5 +++++
M lib/sup/modes/thread-index-mode.rb | 8 ++++++--
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/lib/sup/colormap.rb b/lib/sup/colormap.rb
@@ -64,6 +64,7 @@ class Colormap
     :regular_buf => { :fg => "white", :bg => "default" },
     :modified_buffer => { :fg => "yellow", :bg => "default", :attrs => ["bold"] },
     :date => { :fg => "white", :bg => "default"},
+    :size_widget => { :fg => "white", :bg => "default"},
   }
 
   def initialize
@@ -176,6 +177,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
@@ -872,6 +872,8 @@ protected
         :index_new_color
       elsif starred
         :index_starred_color
+      elsif Colormap.sym_is_defined(:index_subject_color)
+        :index_subject_color
       else
         :index_old_color
       end
@@ -889,11 +891,13 @@ protected
     ] +
       from +
       [
-      [subj_color, size_widget_text],
+      [:size_widget_color, size_widget_text],
       [: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],