--- Begin Message ---
Subject: |
30.0.50; set-face-foreground shows background colors |
Date: |
Wed, 19 Jul 2023 09:09:11 +0200 |
When I try to set the foreground color of a face, e.g. with:
M-x set-face-foreground RET font-lock-string-face RET
and then press TAB to see the available colors, then Emacs displays the
list of colors as background with text in the default foreground.
It would be more useful to see the text with the candidate color as
foreground on the default background.
Maybe you could consider this patch:
diff --git a/lisp/faces.el b/lisp/faces.el
index 44d64c743ba..6233afb0d4d 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -1340,10 +1340,11 @@ read-face-attribute
(format "%s" old-value))))
(setq new-value
(if (memq attribute '(:foreground :background))
- (let ((color
- (read-color
- (format-prompt "%s for face `%s'"
- default attribute-name face))))
+ (let* ((prompt (format-prompt
+ "%s for face `%s'"
+ default attribute-name face))
+ (fg (eq attribute ':foreground))
+ (color (read-color prompt nil nil nil fg)))
(if (equal (string-trim color) "")
default
color))
In GNU Emacs 30.0.50 (build 4, x86_64-pc-linux-gnu, GTK+ Version
3.24.37, cairo version 1.16.0) of 2023-07-19 built on caladan
Repository revision: 8b1c92da79f967172afc3214bc9ee58bd08ddc17
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101007
System Description: Debian GNU/Linux 12 (bookworm)
Configured using:
'configure --with-xpm=ifavailable --with-jpeg=ifavailable
--with-gif=ifavailable --with-tiff=ifavailable'
Configured features:
CAIRO DBUS FREETYPE GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG LIBSELINUX
LIBSYSTEMD LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG SECCOMP SOUND
SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM XINPUT2 GTK3
ZLIB
Important settings:
value of $LANG: C.UTF-8
locale-coding-system: utf-8-unix
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#64725: 30.0.50; set-face-foreground shows background colors |
Date: |
Thu, 03 Aug 2023 10:58:03 +0300 |
> From: Helmut Eller <eller.helmut@gmail.com>
> Cc: 64725@debbugs.gnu.org
> Date: Thu, 20 Jul 2023 16:34:34 +0200
>
> On Wed, Jul 19 2023, Eli Zaretskii wrote:
>
> > That's exactly what I meant: when you customize the foreground color
> > of a face, show the candidates as text in that color on the background
> > of the face's background color, and when you customize the background
> > of a face, show the candidates as background with the text in the
> > foreground color of the face. IOW, show the face with its both colors
> > as it will look if this candidate is chosen.
>
> OK. Here is a patch that should do this:
Thanks, installed on the master branch, and closing the bug.
--- End Message ---