diff options
| author | Anders Lindgren | 2019-05-15 21:00:49 +0200 |
|---|---|---|
| committer | Anders Lindgren | 2019-05-15 21:00:49 +0200 |
| commit | 520aca2d890a051621b730b0a7e97dd07a546df4 (patch) | |
| tree | 646db24c52543c87eb3489053d66a0683a81402e | |
| parent | c3e838166800d5af4be66e80c2be276905a73486 (diff) | |
| download | emacs-520aca2d890a051621b730b0a7e97dd07a546df4.tar.gz emacs-520aca2d890a051621b730b0a7e97dd07a546df4.zip | |
Fix diff-mode face problem when used in terminals (Bug#35695)
In a terminal supporting 256 colors, both diff-added and diff-removed
was mapped to the same greyish color.
* lisp/vc/diff-mode.el: Modify the colors of diff-removed,
diff-added, diff-refine-removed, and diff-refine-added when
used in a 256 color environment.
| -rw-r--r-- | lisp/vc/diff-mode.el | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index a26e9eef824..0d5dc0e1c0c 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el | |||
| @@ -283,6 +283,14 @@ well." | |||
| 283 | ;;;; font-lock support | 283 | ;;;; font-lock support |
| 284 | ;;;; | 284 | ;;;; |
| 285 | 285 | ||
| 286 | ;; Note: The colors used in a color-rich environments (a GUI or in a | ||
| 287 | ;; terminal supporting 24 bit colors) doesn't render well in terminal | ||
| 288 | ;; supporting only 256 colors. Concretely, both #ffeeee | ||
| 289 | ;; (diff-removed) and #eeffee (diff-added) are mapped to the same | ||
| 290 | ;; greyish color. "min-colors 257" ensures that those colors are not | ||
| 291 | ;; used terminals supporting only 256 colors. However, any number | ||
| 292 | ;; between 257 and 2^24 (16777216) would do. | ||
| 293 | |||
| 286 | (defface diff-header | 294 | (defface diff-header |
| 287 | '((((class color) (min-colors 88) (background light)) | 295 | '((((class color) (min-colors 88) (background light)) |
| 288 | :background "grey85") | 296 | :background "grey85") |
| @@ -314,8 +322,10 @@ well." | |||
| 314 | (defface diff-removed | 322 | (defface diff-removed |
| 315 | '((default | 323 | '((default |
| 316 | :inherit diff-changed) | 324 | :inherit diff-changed) |
| 317 | (((class color) (min-colors 88) (background light)) | 325 | (((class color) (min-colors 257) (background light)) |
| 318 | :background "#ffeeee") | 326 | :background "#ffeeee") |
| 327 | (((class color) (min-colors 88) (background light)) | ||
| 328 | :background "#ffdddd") | ||
| 319 | (((class color) (min-colors 88) (background dark)) | 329 | (((class color) (min-colors 88) (background dark)) |
| 320 | :background "#553333") | 330 | :background "#553333") |
| 321 | (((class color)) | 331 | (((class color)) |
| @@ -325,8 +335,10 @@ well." | |||
| 325 | (defface diff-added | 335 | (defface diff-added |
| 326 | '((default | 336 | '((default |
| 327 | :inherit diff-changed) | 337 | :inherit diff-changed) |
| 328 | (((class color) (min-colors 88) (background light)) | 338 | (((class color) (min-colors 257) (background light)) |
| 329 | :background "#eeffee") | 339 | :background "#eeffee") |
| 340 | (((class color) (min-colors 88) (background light)) | ||
| 341 | :background "#ddffdd") | ||
| 330 | (((class color) (min-colors 88) (background dark)) | 342 | (((class color) (min-colors 88) (background dark)) |
| 331 | :background "#335533") | 343 | :background "#335533") |
| 332 | (((class color)) | 344 | (((class color)) |
| @@ -2040,8 +2052,10 @@ For use in `add-log-current-defun-function'." | |||
| 2040 | (defface diff-refine-removed | 2052 | (defface diff-refine-removed |
| 2041 | '((default | 2053 | '((default |
| 2042 | :inherit diff-refine-changed) | 2054 | :inherit diff-refine-changed) |
| 2043 | (((class color) (min-colors 88) (background light)) | 2055 | (((class color) (min-colors 257) (background light)) |
| 2044 | :background "#ffcccc") | 2056 | :background "#ffcccc") |
| 2057 | (((class color) (min-colors 88) (background light)) | ||
| 2058 | :background "#ffbbbb") | ||
| 2045 | (((class color) (min-colors 88) (background dark)) | 2059 | (((class color) (min-colors 88) (background dark)) |
| 2046 | :background "#aa2222")) | 2060 | :background "#aa2222")) |
| 2047 | "Face used for removed characters shown by `diff-refine-hunk'." | 2061 | "Face used for removed characters shown by `diff-refine-hunk'." |
| @@ -2050,8 +2064,10 @@ For use in `add-log-current-defun-function'." | |||
| 2050 | (defface diff-refine-added | 2064 | (defface diff-refine-added |
| 2051 | '((default | 2065 | '((default |
| 2052 | :inherit diff-refine-changed) | 2066 | :inherit diff-refine-changed) |
| 2053 | (((class color) (min-colors 88) (background light)) | 2067 | (((class color) (min-colors 257) (background light)) |
| 2054 | :background "#bbffbb") | 2068 | :background "#bbffbb") |
| 2069 | (((class color) (min-colors 88) (background light)) | ||
| 2070 | :background "#aaffaa") | ||
| 2055 | (((class color) (min-colors 88) (background dark)) | 2071 | (((class color) (min-colors 88) (background dark)) |
| 2056 | :background "#22aa22")) | 2072 | :background "#22aa22")) |
| 2057 | "Face used for added characters shown by `diff-refine-hunk'." | 2073 | "Face used for added characters shown by `diff-refine-hunk'." |