[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: color-grey-p and black?
From: |
Richard M. Stallman |
Subject: |
Re: color-grey-p and black? |
Date: |
Wed, 28 Sep 2005 13:10:46 -0400 |
Does this patch give good results?
*** xfaces.c 27 Sep 2005 17:58:18 -0400 1.336
--- xfaces.c 27 Sep 2005 23:09:16 -0400
***************
*** 1477,1483 ****
/* Return non-zero if COLOR_NAME is a shade of gray (or white or
! black) on frame F. The algorithm is taken from 20.2 faces.el. */
static int
face_color_gray_p (f, color_name)
--- 1477,1485 ----
/* Return non-zero if COLOR_NAME is a shade of gray (or white or
! black) on frame F.
!
! The criterion implemented here is not a terribly sophisticated one. */
static int
face_color_gray_p (f, color_name)
***************
*** 1488,1499 ****
int gray_p;
if (defined_color (f, color_name, &color, 0))
! gray_p = ((abs (color.red - color.green)
! < max (color.red, color.green) / 20)
! && (abs (color.green - color.blue)
! < max (color.green, color.blue) / 20)
! && (abs (color.blue - color.red)
! < max (color.blue, color.red) / 20));
else
gray_p = 0;
--- 1490,1504 ----
int gray_p;
if (defined_color (f, color_name, &color, 0))
! gray_p = (/* Any color sufficiently close to black counts as grey. */
! (color.red < 5000 && color.green < 5000 && color.blue < 5000)
! ||
! ((abs (color.red - color.green)
! < max (color.red, color.green) / 20)
! && (abs (color.green - color.blue)
! < max (color.green, color.blue) / 20)
! && (abs (color.blue - color.red)
! < max (color.blue, color.red) / 20)));
else
gray_p = 0;