/[emacs]/emacs/src/xfaces.c
ViewVC logotype

Diff of /emacs/src/xfaces.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.336 by dann, Tue Sep 27 18:48:54 2005 UTC revision 1.337 by rms, Sun Oct 2 03:28:56 2005 UTC
# Line 1477  tty_color_name (f, idx) Line 1477  tty_color_name (f, idx)
1477    
1478    
1479  /* Return non-zero if COLOR_NAME is a shade of gray (or white or  /* Return non-zero if COLOR_NAME is a shade of gray (or white or
1480     black) on frame F.  The algorithm is taken from 20.2 faces.el.  */     black) on frame F.
1481    
1482       The criterion implemented here is not a terribly sophisticated one.  */
1483    
1484  static int  static int
1485  face_color_gray_p (f, color_name)  face_color_gray_p (f, color_name)
# Line 1488  face_color_gray_p (f, color_name) Line 1490  face_color_gray_p (f, color_name)
1490    int gray_p;    int gray_p;
1491    
1492    if (defined_color (f, color_name, &color, 0))    if (defined_color (f, color_name, &color, 0))
1493      gray_p = ((abs (color.red - color.green)      gray_p = (/* Any color sufficiently close to black counts as grey.  */
1494                 < max (color.red, color.green) / 20)                (color.red < 5000 && color.green < 5000 && color.blue < 5000)
1495                && (abs (color.green - color.blue)                ||
1496                    < max (color.green, color.blue) / 20)                ((abs (color.red - color.green)
1497                && (abs (color.blue - color.red)                  < max (color.red, color.green) / 20)
1498                    < max (color.blue, color.red) / 20));                 && (abs (color.green - color.blue)
1499                       < max (color.green, color.blue) / 20)
1500                   && (abs (color.blue - color.red)
1501                       < max (color.blue, color.red) / 20)));
1502    else    else
1503      gray_p = 0;      gray_p = 0;
1504    

Legend:
Removed from v.1.336  
changed lines
  Added in v.1.337

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26