diff options
| author | Richard M. Stallman | 2005-10-02 03:28:56 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2005-10-02 03:28:56 +0000 |
| commit | 71433d39f54a26dbe9b5ff6c87e66e8cba8b2c10 (patch) | |
| tree | 9211021d833c999fff43839b1f0f51ba6d3e11cb /src | |
| parent | 24bbdbefccdba78e91874559d3b7dee0c1cbdbe6 (diff) | |
| download | emacs-71433d39f54a26dbe9b5ff6c87e66e8cba8b2c10.tar.gz emacs-71433d39f54a26dbe9b5ff6c87e66e8cba8b2c10.zip | |
(face_color_gray_p): Colors close to black count as gray.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xfaces.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/xfaces.c b/src/xfaces.c index aa32c84b297..49ba6d334ec 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -1477,7 +1477,9 @@ tty_color_name (f, idx) | |||
| 1477 | 1477 | ||
| 1478 | 1478 | ||
| 1479 | /* Return non-zero if COLOR_NAME is a shade of gray (or white or | 1479 | /* 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. */ | 1480 | black) on frame F. |
| 1481 | |||
| 1482 | The criterion implemented here is not a terribly sophisticated one. */ | ||
| 1481 | 1483 | ||
| 1482 | static int | 1484 | static int |
| 1483 | face_color_gray_p (f, color_name) | 1485 | face_color_gray_p (f, color_name) |
| @@ -1488,12 +1490,15 @@ face_color_gray_p (f, color_name) | |||
| 1488 | int gray_p; | 1490 | int gray_p; |
| 1489 | 1491 | ||
| 1490 | if (defined_color (f, color_name, &color, 0)) | 1492 | if (defined_color (f, color_name, &color, 0)) |
| 1491 | gray_p = ((abs (color.red - color.green) | 1493 | gray_p = (/* Any color sufficiently close to black counts as grey. */ |
| 1492 | < max (color.red, color.green) / 20) | 1494 | (color.red < 5000 && color.green < 5000 && color.blue < 5000) |
| 1493 | && (abs (color.green - color.blue) | 1495 | || |
| 1494 | < max (color.green, color.blue) / 20) | 1496 | ((abs (color.red - color.green) |
| 1495 | && (abs (color.blue - color.red) | 1497 | < max (color.red, color.green) / 20) |
| 1496 | < max (color.blue, color.red) / 20)); | 1498 | && (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))); | ||
| 1497 | else | 1502 | else |
| 1498 | gray_p = 0; | 1503 | gray_p = 0; |
| 1499 | 1504 | ||