unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: Matt Armstrong <matt@rfc20.org>
Cc: 46396@debbugs.gnu.org, bug-gnu-emacs_at_gnu.org@tangential.info
Subject: bug#46396: 27.1.90; Ediff's non-focused diff section, background too light in --reverse
Date: Wed, 10 Feb 2021 19:01:21 +0200	[thread overview]
Message-ID: <87blcs2f9q.fsf@mail.linkov.net> (raw)
In-Reply-To: <m2czx8idvw.fsf@matts-mbp-2016.lan> (Matt Armstrong's message of "Tue, 09 Feb 2021 23:24:35 -0800")

[-- Attachment #1: Type: text/plain, Size: 1707 bytes --]

> The origin of the faces without a foreground setting is commit
> 382ceb2cdbedc06b06d9fb424d83f531339a3311 by Juri Linkov <juri@jurta.org>
> while working on https://debbugs.gnu.org/cgi/bugreport.cgi?bug=10181.
>
> I've cc'd him here. Juri, can you comment?

Thanks for pointing me at this issue since I had not realized
this is related to something affected by my previous changes.

> I'm especially interested to hear your thoughts on why the change made
> things nicer (what you said in
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=10181#84).

The core point of my 2014-year message was that with the specified foreground,
Ediff removes font-lock highlighting on non-current differences.
The need for keeping the font-lock foreground colors is evident
when looking at these font-lock colors in buffers where the effect
of font-lock is noticeable, such as changes in the source code files.

But I completely agree that the current contrast is too low on a dark theme.

Fortunately, now we have a feature that will help to fix this problem:
the face attribute :distant-foreground specifies the alternative
foreground color that is used only when the background color is too
close to the foreground color, thus making the text readable in this case.

> Or, perhaps the ediff faces should vary the background based on
> (background light) and (background dark)?

The background colors could be adjusted as well for dark backgrounds.

After changing background colors to darker colors and adding
:distant-foreground I tried different default foreground colors with

  M-x set-foreground-color RET dark grey RET

and it seems everything looks readable.

Do you see more problems with the following patch?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ediff-dark.patch --]
[-- Type: text/x-diff, Size: 4339 bytes --]

diff --git a/lisp/vc/ediff-init.el b/lisp/vc/ediff-init.el
index 6e658163b9..3f33e6aae2 100644
--- a/lisp/vc/ediff-init.el
+++ b/lisp/vc/ediff-init.el
@@ -980,8 +980,10 @@ stipple-pixmap
 (defface ediff-even-diff-A
   `((((type pc))
      (:foreground "green3" :background "light grey" :extend t))
-    (((class color) (min-colors 88))
-     (:background "light grey" :extend t))
+    (((class color) (min-colors 88) (background light))
+     (:distant-foreground "Black" :background "light grey" :extend t))
+    (((class color) (min-colors 88) (background dark))
+     (:distant-foreground "White" :background "dark grey" :extend t))
     (((class color) (min-colors 16))
      (:foreground "Black" :background "light grey" :extend t))
     (((class color))
@@ -999,8 +1001,10 @@ ediff-even-diff-face-A
 this variable represents.")
 
 (defface ediff-even-diff-B
-  `((((class color) (min-colors 88))
-     (:background "Grey" :extend t))
+  `((((class color) (min-colors 88) (background light))
+     (:distant-foreground "Black" :background "Grey" :extend t))
+    (((class color) (min-colors 88) (background dark))
+     (:distant-foreground "White" :background "dim grey" :extend t))
     (((class color) (min-colors 16))
      (:foreground "White" :background "Grey" :extend t))
     (((class color))
@@ -1019,8 +1023,10 @@ ediff-even-diff-face-B
 (defface ediff-even-diff-C
   `((((type pc))
      (:foreground "yellow3" :background "light grey" :extend t))
-    (((class color) (min-colors 88))
-     (:background "light grey" :extend t))
+    (((class color) (min-colors 88) (background light))
+     (:distant-foreground "Black" :background "light grey" :extend t))
+    (((class color) (min-colors 88) (background dark))
+     (:distant-foreground "White" :background "dark grey" :extend t))
     (((class color) (min-colors 16))
      (:foreground "Black" :background "light grey" :extend t))
     (((class color))
@@ -1040,8 +1046,10 @@ ediff-even-diff-face-C
 (defface ediff-even-diff-Ancestor
   `((((type pc))
      (:foreground "cyan3" :background "light grey" :extend t))
-    (((class color) (min-colors 88))
-     (:background "Grey" :extend t))
+    (((class color) (min-colors 88) (background light))
+     (:distant-foreground "Black" :background "Grey" :extend t))
+    (((class color) (min-colors 88) (background dark))
+     (:distant-foreground "White" :background "dim grey" :extend t))
     (((class color) (min-colors 16))
      (:foreground "White" :background "Grey" :extend t))
     (((class color))
@@ -1068,8 +1076,10 @@ ediff-even-diff-face-alist
 (defface ediff-odd-diff-A
   '((((type pc))
      (:foreground "green3" :background "gray40" :extend t))
-    (((class color) (min-colors 88))
-     (:background "Grey" :extend t))
+    (((class color) (min-colors 88) (background light))
+     (:distant-foreground "Black" :background "Grey" :extend t))
+    (((class color) (min-colors 88) (background dark))
+     (:distant-foreground "White" :background "dim grey" :extend t))
     (((class color) (min-colors 16))
      (:foreground "White" :background "Grey" :extend t))
     (((class color))
@@ -1088,8 +1098,10 @@ ediff-odd-diff-face-A
 (defface ediff-odd-diff-B
   '((((type pc))
      (:foreground "White" :background "gray40" :extend t))
-    (((class color) (min-colors 88))
-     (:background "light grey" :extend t))
+    (((class color) (min-colors 88) (background light))
+     (:distant-foreground "Black" :background "light grey" :extend t))
+    (((class color) (min-colors 88) (background dark))
+     (:distant-foreground "White" :background "dark grey" :extend t))
     (((class color) (min-colors 16))
      (:foreground "Black" :background "light grey" :extend t))
     (((class color))
@@ -1108,8 +1120,10 @@ ediff-odd-diff-face-B
 (defface ediff-odd-diff-C
   '((((type pc))
      (:foreground "yellow3" :background "gray40" :extend t))
-    (((class color) (min-colors 88))
-     (:background "Grey" :extend t))
+    (((class color) (min-colors 88) (background light))
+     (:distant-foreground "Black" :background "Grey" :extend t))
+    (((class color) (min-colors 88) (background dark))
+     (:distant-foreground "White" :background "dim grey" :extend t))
     (((class color) (min-colors 16))
      (:foreground "White" :background "Grey" :extend t))
     (((class color))

  reply	other threads:[~2021-02-10 17:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-09  9:19 bug#46396: 27.1.90; Ediff's non-focused diff section, background too light in --reverse bug-gnu-emacs_at_gnu.org
2021-02-10  6:46 ` Matt Armstrong
2021-02-10  7:24   ` Matt Armstrong
2021-02-10 17:01     ` Juri Linkov [this message]
2021-02-10 18:24       ` Matt Armstrong
2021-02-10 19:39         ` Juri Linkov
2021-02-10 20:28           ` Matt Armstrong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87blcs2f9q.fsf@mail.linkov.net \
    --to=juri@jurta.org \
    --cc=46396@debbugs.gnu.org \
    --cc=bug-gnu-emacs_at_gnu.org@tangential.info \
    --cc=matt@rfc20.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).