<<< Date Index >>>     <<< Thread Index >>>

[patch] Colored mailboxes on new mail



Hey guys, I made a tiny patch here against the latest mutt devel version - it's
poorly done but it "just works".  I use a smallish font, and sometimes miss the
"N" flag at a glance, so I figured making the mailbox stand out more was in
order.

If anyone is interested, I'd clean this up and do it a shade more "proper",
along with nice little regexps.  But for right now it just uses the "newmail"
named color setting.

So, enjoy, I guess.

--- mutt_curses.h~      2004-06-17 15:33:04.000000000 -0500
+++ mutt_curses.h       2005-11-16 15:39:01.000000000 -0600
@@ -121,6 +121,7 @@
   MT_COLOR_BOLD,
   MT_COLOR_UNDERLINE,
   MT_COLOR_INDEX,
+  MT_COLOR_NEWMAIL,
   MT_COLOR_MAX
 };
 
--- color.c~    2005-02-03 12:47:52.000000000 -0600
+++ color.c     2005-11-16 15:39:01.000000000 -0600
@@ -93,6 +93,7 @@
   { "bold",            MT_COLOR_BOLD },
   { "underline",       MT_COLOR_UNDERLINE },
   { "index",           MT_COLOR_INDEX },
+  { "newmail",         MT_COLOR_NEWMAIL },
   { NULL,              0 }
 };
 
--- browser.c   2005-08-11 14:37:01.000000000 -0500
+++ browser.c   2005-11-16 15:37:37.000000000 -0600
@@ -471,13 +471,26 @@
   return (regexec (re, ((struct folder_file *) menu->data)[n].name, 0, NULL, 
0));
 }
 
+int newmail_color(int index)
+{
+   return ColorDefs[MT_COLOR_NEWMAIL];
+}
+
+int default_color(int index)
+{
+   return ColorDefs[MT_COLOR_INDEX];
+}
+
 static void folder_entry (char *s, size_t slen, MUTTMENU *menu, int num)
 {
   FOLDER folder;
 
   folder.ff = &((struct folder_file *) menu->data)[num];
   folder.num = num;
-  
+
+  if(folder.ff->new) menu->color = newmail_color;
+  else menu->color = default_color;
+
   mutt_FormatString (s, slen, NONULL(FolderFormat), folder_format_str, 
       (unsigned long) &folder, M_FORMAT_ARROWCURSOR);
 }