Commit 520aca2d authored by Anders Lindgren's avatar Anders Lindgren

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.
parent c3e83816
Pipeline #1675 failed with stage
in 51 minutes and 29 seconds
...@@ -283,6 +283,14 @@ well." ...@@ -283,6 +283,14 @@ well."
;;;; font-lock support ;;;; font-lock support
;;;; ;;;;
;; Note: The colors used in a color-rich environments (a GUI or in a
;; terminal supporting 24 bit colors) doesn't render well in terminal
;; supporting only 256 colors. Concretely, both #ffeeee
;; (diff-removed) and #eeffee (diff-added) are mapped to the same
;; greyish color. "min-colors 257" ensures that those colors are not
;; used terminals supporting only 256 colors. However, any number
;; between 257 and 2^24 (16777216) would do.
(defface diff-header (defface diff-header
'((((class color) (min-colors 88) (background light)) '((((class color) (min-colors 88) (background light))
:background "grey85") :background "grey85")
...@@ -314,8 +322,10 @@ well." ...@@ -314,8 +322,10 @@ well."
(defface diff-removed (defface diff-removed
'((default '((default
:inherit diff-changed) :inherit diff-changed)
(((class color) (min-colors 88) (background light)) (((class color) (min-colors 257) (background light))
:background "#ffeeee") :background "#ffeeee")
(((class color) (min-colors 88) (background light))
:background "#ffdddd")
(((class color) (min-colors 88) (background dark)) (((class color) (min-colors 88) (background dark))
:background "#553333") :background "#553333")
(((class color)) (((class color))
...@@ -325,8 +335,10 @@ well." ...@@ -325,8 +335,10 @@ well."
(defface diff-added (defface diff-added
'((default '((default
:inherit diff-changed) :inherit diff-changed)
(((class color) (min-colors 88) (background light)) (((class color) (min-colors 257) (background light))
:background "#eeffee") :background "#eeffee")
(((class color) (min-colors 88) (background light))
:background "#ddffdd")
(((class color) (min-colors 88) (background dark)) (((class color) (min-colors 88) (background dark))
:background "#335533") :background "#335533")
(((class color)) (((class color))
...@@ -2040,8 +2052,10 @@ For use in `add-log-current-defun-function'." ...@@ -2040,8 +2052,10 @@ For use in `add-log-current-defun-function'."
(defface diff-refine-removed (defface diff-refine-removed
'((default '((default
:inherit diff-refine-changed) :inherit diff-refine-changed)
(((class color) (min-colors 88) (background light)) (((class color) (min-colors 257) (background light))
:background "#ffcccc") :background "#ffcccc")
(((class color) (min-colors 88) (background light))
:background "#ffbbbb")
(((class color) (min-colors 88) (background dark)) (((class color) (min-colors 88) (background dark))
:background "#aa2222")) :background "#aa2222"))
"Face used for removed characters shown by `diff-refine-hunk'." "Face used for removed characters shown by `diff-refine-hunk'."
...@@ -2050,8 +2064,10 @@ For use in `add-log-current-defun-function'." ...@@ -2050,8 +2064,10 @@ For use in `add-log-current-defun-function'."
(defface diff-refine-added (defface diff-refine-added
'((default '((default
:inherit diff-refine-changed) :inherit diff-refine-changed)
(((class color) (min-colors 88) (background light)) (((class color) (min-colors 257) (background light))
:background "#bbffbb") :background "#bbffbb")
(((class color) (min-colors 88) (background light))
:background "#aaffaa")
(((class color) (min-colors 88) (background dark)) (((class color) (min-colors 88) (background dark))
:background "#22aa22")) :background "#22aa22"))
"Face used for added characters shown by `diff-refine-hunk'." "Face used for added characters shown by `diff-refine-hunk'."
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment