aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-format.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-07-27 03:17:20 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-07-27 03:17:20 +0800
commitad7a5a909534915ed585e2795606f11d7260e0c7 (patch)
tree8e317c1f55d6a601b673579e28f79a112a9042ea /mail/mail-format.c
parent8e10bc69590b5594b95abcc8a8efd26bbdd86d2b (diff)
downloadgsoc2013-evolution-ad7a5a909534915ed585e2795606f11d7260e0c7.tar.gz
gsoc2013-evolution-ad7a5a909534915ed585e2795606f11d7260e0c7.tar.zst
gsoc2013-evolution-ad7a5a909534915ed585e2795606f11d7260e0c7.zip
Respect Gtk theme colors for the fonts and calculate a new table gbcolor
2001-07-26 Jeffrey Stedfast <fejj@ximian.com> * mail-format.c (write_headers): Respect Gtk theme colors for the fonts and calculate a new table gbcolor based on gtk theme preferences. * mail-config.glade: Label the enabled field. svn path=/trunk/; revision=11431
Diffstat (limited to 'mail/mail-format.c')
-rw-r--r--mail/mail-format.c49
1 files changed, 45 insertions, 4 deletions
diff --git a/mail/mail-format.c b/mail/mail-format.c
index 795bfefa5d..0bef35aeee 100644
--- a/mail/mail-format.c
+++ b/mail/mail-format.c
@@ -864,27 +864,68 @@ write_header (CamelMimeMessage *message, MailDisplay *md,
write_text_header (name, value, flags, md->html, md->stream);
}
+#define COLOR_IS_LIGHT(r, g, b) ((r + g + b) > (128 * 3))
+
static void
write_headers (CamelMimeMessage *message, MailDisplay *md)
{
- GArray *gheaders;
+ gboolean full = (md->display_style == MAIL_CONFIG_DISPLAY_FULL_HEADERS);
CamelMediumHeader *headers, default_headers[] = {
{ "From", NULL }, { "Reply-To", NULL },
{ "To", NULL }, { "Cc" , NULL }, { "Subject", NULL },
{ "Date", NULL }
};
+ char bgcolor[7], fontcolor[7];
+ GtkStyle *style = NULL;
int i, len, flags;
- gboolean full = (md->display_style == MAIL_CONFIG_DISPLAY_FULL_HEADERS);
+ GArray *gheaders;
+
+ /* My favorite thing to do...much around with colors so we respect people's stupid themes */
+ style = gtk_widget_get_style (GTK_WIDGET (md->html));
+ if (style) {
+ int state = GTK_WIDGET_STATE (GTK_WIDGET (md->html));
+ gushort r, g, b;
+
+ r = style->base[state].red / 256;
+ g = style->base[state].green / 256;
+ b = style->base[state].blue / 256;
+
+ if (COLOR_IS_LIGHT (r, g, b)) {
+ r *= 0.92;
+ g *= 0.92;
+ b *= 0.92;
+ } else {
+ r = 255 - (0.92 * (255 - r));
+ g = 255 - (0.92 * (255 - g));
+ b = 255 - (0.92 * (255 - b));
+ }
+
+ g_warning ("%d, %d, %d", r, g, b);
+ sprintf (bgcolor, "%.2X%.2X%.2X", r, g, b);
+
+ r = style->text[state].red;
+ g = style->text[state].green / 256;
+ b = style->text[state].blue / 256;
+
+ sprintf (fontcolor, "%.2X%.2X%.2X", r, g, b);
+ } else {
+ strcpy (bgcolor, "EEEEEE");
+ strcpy (fontcolor, "000000");
+ }
mail_html_write (md->html, md->stream,
"<table width=\"100%%\" cellpadding=0 cellspacing=0>"
"<tr><td colspan=3 height=10><table height=10 cellpadding=0 cellspacing=0>"
"<tr><td></td></tr></table></td></tr>"
"<tr><td><table width=10 cellpadding=0 cellspacing=0><tr><td></td></tr></table></td>"
- "<td width=\"100%%\"><font color=\"#000000\">"
+ "<td width=\"100%%\"><font color=\"#");
+ mail_html_write (md->html, md->stream, fontcolor);
+ mail_html_write (md->html, md->stream, "\">"
"<table bgcolor=\"#000000\" width=\"100%%\" "
"cellspacing=0 cellpadding=1><tr><td>"
- "<table bgcolor=\"#EEEEEE\" width=\"100%%\" cellpadding=0 cellspacing=0>"
+ "<table bgcolor=\"#");
+ mail_html_write (md->html, md->stream, bgcolor);
+ mail_html_write (md->html, md->stream, "\" width=\"100%%\" cellpadding=0 cellspacing=0>"
"<tr><td><table>\n");
if (full) {