Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
* [sup-devel] Label colors support
@ 2010-08-03 22:14 Matias Aguirre
  2010-08-04 16:41 ` Matias Aguirre
  2010-08-19  8:13 ` Sascha Silbe
  0 siblings, 2 replies; 7+ messages in thread
From: Matias Aguirre @ 2010-08-03 22:14 UTC (permalink / raw)
  To: sup-devel

[-- Attachment #1: Type: text/plain, Size: 412 bytes --]

Hi,

Been an user for some time now, congrats for the good work. But there's
something I've missed from mutt and is the ability to customize inbox
emails colors, I've used to colorize by source address or domain.

Attached is a patch (first ruby code in a lot of time) with needed
changes to allow colors by label and produces a good and quick feedback.

Cheers,
Matías
--
Matías Aguirre <matias@insophia.com>

[-- Attachment #2: color_labels.diff --]
[-- Type: application/octet-stream, Size: 1064 bytes --]

diff --git a/lib/sup/colormap.rb b/lib/sup/colormap.rb
index 7de48db..087995a 100644
--- a/lib/sup/colormap.rb
+++ b/lib/sup/colormap.rb
@@ -175,6 +175,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
index 0c7a3f2..c90a42c 100644
--- a/lib/sup/modes/thread-index-mode.rb
+++ b/lib/sup/modes/thread-index-mode.rb
@@ -893,7 +893,7 @@ 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}_color".to_sym) || :label_color, "#{label} "] } +
       [
       [subj_color, t.subj + (t.subj.empty? ? "" : " ")],
       [:snippet_color, t.snippet],

[-- Attachment #3: Type: text/plain, Size: 143 bytes --]

_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-01-26 21:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-03 22:14 [sup-devel] Label colors support Matias Aguirre
2010-08-04 16:41 ` Matias Aguirre
2010-08-04 16:50   ` Matias Aguirre
2010-08-19  8:13 ` Sascha Silbe
2010-08-19 21:04   ` Matias Aguirre
2011-01-26 20:20     ` Michael Stapelberg
2011-01-26 21:21       ` Matias Aguirre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox