diff options
| author | Miles Bader | 2000-11-14 01:45:45 +0000 |
|---|---|---|
| committer | Miles Bader | 2000-11-14 01:45:45 +0000 |
| commit | d7361edf01f3c7b4cc76d27e36b7e9dbad597147 (patch) | |
| tree | 78c8c9e232a92a77c98f16b2c7f286cfb90858a8 /src | |
| parent | 787994b796ea6bf18824f76c5f7c91d4e3fe41e8 (diff) | |
| download | emacs-d7361edf01f3c7b4cc76d27e36b7e9dbad597147.tar.gz emacs-d7361edf01f3c7b4cc76d27e36b7e9dbad597147.zip | |
(x_alloc_lighter_color): Use real brightness calculation.
Just use FACTOR/2 instead of HIGHLIGHT_COLOR_DARK_BOOST.
(HIGHLIGHT_COLOR_DARK_BOOST): Macro removed.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/xterm.c | 34 |
2 files changed, 15 insertions, 25 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 86362c4086b..31a116a8fe6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2000-11-14 Miles Bader <miles@lsi.nec.co.jp> | ||
| 2 | |||
| 3 | * xterm.c (x_alloc_lighter_color): Use real brightness calculation. | ||
| 4 | Just use FACTOR/2 instead of HIGHLIGHT_COLOR_DARK_BOOST. | ||
| 5 | (HIGHLIGHT_COLOR_DARK_BOOST): Macro removed. | ||
| 6 | |||
| 1 | 2000-11-14 Miles Bader <miles@gnu.org> | 7 | 2000-11-14 Miles Bader <miles@gnu.org> |
| 2 | 8 | ||
| 3 | * xterm.c (x_alloc_lighter_color): Include an additive component | 9 | * xterm.c (x_alloc_lighter_color): Include an additive component |
diff --git a/src/xterm.c b/src/xterm.c index 43294d267c5..ec7f6b16d02 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -3489,24 +3489,14 @@ x_copy_dpy_color (dpy, cmap, pixel) | |||
| 3489 | } | 3489 | } |
| 3490 | 3490 | ||
| 3491 | 3491 | ||
| 3492 | |||
| 3493 | /* Constants used by x_alloc_lighter_color. */ | ||
| 3494 | |||
| 3495 | /* How much to boost the brightness of 3d highlights for dark colors. | ||
| 3496 | Nominally, highlight colors for `3d' faces are calculated by | ||
| 3497 | brightening an object's color by a constant factor. If | ||
| 3498 | `highlight-color-dark-boost' is a floating point number between 0 and | ||
| 3499 | 1, colors darker than `highlight-color-dark-boost-limit' have their | ||
| 3500 | highlight factor increased: a value of 0 means no increase at all, | ||
| 3501 | and greater values yield correspondingly greater increases. */ | ||
| 3502 | #define HIGHLIGHT_COLOR_DARK_BOOST 0.7 | ||
| 3503 | |||
| 3504 | /* Brightness beyond which a color won't have its highlight brightness | 3492 | /* Brightness beyond which a color won't have its highlight brightness |
| 3505 | boosted. See HIGHLIGHT_COLOR_DARK_BOOST. | 3493 | boosted. |
| 3506 | 3494 | ||
| 3507 | The `brightness' of a color, for this purpose, is defined to be the | 3495 | Nominally, highlight colors for `3d' faces are calculated by |
| 3508 | maximum of the color's red, green, or blue components, as returned by | 3496 | brightening an object's color by a constant scale factor, but this |
| 3509 | `color-values'. | 3497 | doesn't yield good results for dark colors, so for colors who's |
| 3498 | brightness is less than this value (on a scale of 0-65535) have an | ||
| 3499 | use an additional additive factor. | ||
| 3510 | 3500 | ||
| 3511 | The value here is set so that the default menu-bar/mode-line color | 3501 | The value here is set so that the default menu-bar/mode-line color |
| 3512 | (grey75) will not have its highlights changed at all. */ | 3502 | (grey75) will not have its highlights changed at all. */ |
| @@ -3543,13 +3533,8 @@ x_alloc_lighter_color (f, display, cmap, pixel, factor, delta) | |||
| 3543 | new.green = min (0xffff, factor * color.green); | 3533 | new.green = min (0xffff, factor * color.green); |
| 3544 | new.blue = min (0xffff, factor * color.blue); | 3534 | new.blue = min (0xffff, factor * color.blue); |
| 3545 | 3535 | ||
| 3546 | /* Use the maximum component brightness as the overall brightness | 3536 | /* Calculate brightness of COLOR. */ |
| 3547 | (this works quite well in practice). */ | 3537 | bright = (2 * color.red + 3 * color.green + color.blue) / 6; |
| 3548 | bright = color.red; | ||
| 3549 | if (color.green > bright) | ||
| 3550 | bright = color.green; | ||
| 3551 | if (color.blue > bright) | ||
| 3552 | bright = color.blue; | ||
| 3553 | 3538 | ||
| 3554 | /* We only boost colors that are darker than | 3539 | /* We only boost colors that are darker than |
| 3555 | HIGHLIGHT_COLOR_DARK_BOOST_LIMIT. */ | 3540 | HIGHLIGHT_COLOR_DARK_BOOST_LIMIT. */ |
| @@ -3560,11 +3545,10 @@ x_alloc_lighter_color (f, display, cmap, pixel, factor, delta) | |||
| 3560 | /* How far below the limit this color is (0 - 1, 1 being darker). */ | 3545 | /* How far below the limit this color is (0 - 1, 1 being darker). */ |
| 3561 | double dimness = 1 - (double)bright / HIGHLIGHT_COLOR_DARK_BOOST_LIMIT; | 3546 | double dimness = 1 - (double)bright / HIGHLIGHT_COLOR_DARK_BOOST_LIMIT; |
| 3562 | /* The additive adjustment. */ | 3547 | /* The additive adjustment. */ |
| 3563 | int min_delta = delta * dimness * HIGHLIGHT_COLOR_DARK_BOOST; | 3548 | int min_delta = delta * dimness * factor / 2; |
| 3564 | 3549 | ||
| 3565 | if (factor < 1) | 3550 | if (factor < 1) |
| 3566 | { | 3551 | { |
| 3567 | min_delta /= 2; | ||
| 3568 | new.red = max (0, new.red - min_delta); | 3552 | new.red = max (0, new.red - min_delta); |
| 3569 | new.green = max (0, new.green - min_delta); | 3553 | new.green = max (0, new.green - min_delta); |
| 3570 | new.blue = max (0, new.blue - min_delta); | 3554 | new.blue = max (0, new.blue - min_delta); |