ayttm-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Ayttm-commits] CVS: ayttm/src/gtk gtk_eb_html.c,1.2,1.3


From: Philip S Tellis <address@hidden>
Subject: [Ayttm-commits] CVS: ayttm/src/gtk gtk_eb_html.c,1.2,1.3
Date: Thu, 30 Jan 2003 07:02:33 -0500

Update of /cvsroot/ayttm/ayttm/src/gtk
In directory subversions:/tmp/cvs-serv3114/src/gtk

Modified Files:
        gtk_eb_html.c 
Log Message:
fix contrast if bg is not that dark

Index: gtk_eb_html.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/gtk/gtk_eb_html.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- gtk_eb_html.c       29 Jan 2003 19:19:23 -0000      1.2
+++ gtk_eb_html.c       30 Jan 2003 12:02:31 -0000      1.3
@@ -407,36 +407,32 @@
 
 }
 
-static int _lighten(int color)
+static const int colour_threshold = 0x60;
+static int _lighten(int colour)
 {
-       if(color < 0x80)
-       {
-               return color + 0x80;
-       }
-       return 0xFF;
+       if(colour + colour_threshold < 0xff)
+               return colour + colour_threshold;
+       else
+               return 0xff;
 }
 
-static int _darken(int color)
+static int _darken(int colour)
 {
-       if(color > 0x80)
-       {
-               return color - 0x80;
-       }
-       return 0x00;
+       if(colour - colour_threshold > 0)
+               return colour - colour_threshold;
+       else
+               return 0;
 }
 
 static int _is_dark(int r, int g, int b)
 {
-       if((r+g+b)<(0x80*3))
-       {
-               return 1;
-       }
-       return 0;
+       return (r + g + b < 3 * colour_threshold);
 }
 
 static void _adjust_colors(int*fg_r, int*fg_g, int*fg_b,
                int r, int g, int b)
 {
+
        int bg_dark = _is_dark(r,g,b);
        int fg_dark = _is_dark(*fg_r, *fg_g, *fg_b);
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]