unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#64725: 30.0.50; set-face-foreground shows background colors
@ 2023-07-19  7:09 Helmut Eller
  2023-07-19 12:44 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Helmut Eller @ 2023-07-19  7:09 UTC (permalink / raw)
  To: 64725

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


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:


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

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))

[-- Attachment #3: Type: text/plain, Size: 792 bytes --]




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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-08-03  7:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-19  7:09 bug#64725: 30.0.50; set-face-foreground shows background colors Helmut Eller
2023-07-19 12:44 ` Eli Zaretskii
2023-07-19 15:45   ` Helmut Eller
2023-07-19 16:26     ` Eli Zaretskii
2023-07-20 14:34       ` Helmut Eller
2023-08-03  7:58         ` Eli Zaretskii

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).