From unknown Tue Jun 17 20:17:56 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#64725 <64725@debbugs.gnu.org> To: bug#64725 <64725@debbugs.gnu.org> Subject: Status: 30.0.50; set-face-foreground shows background colors Reply-To: bug#64725 <64725@debbugs.gnu.org> Date: Wed, 18 Jun 2025 03:17:56 +0000 retitle 64725 30.0.50; set-face-foreground shows background colors reassign 64725 emacs submitter 64725 Helmut Eller severity 64725 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 19 03:09:32 2023 Received: (at submit) by debbugs.gnu.org; 19 Jul 2023 07:09:32 +0000 Received: from localhost ([127.0.0.1]:54840 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qM1JU-0004Fl-5Y for submit@debbugs.gnu.org; Wed, 19 Jul 2023 03:09:32 -0400 Received: from lists.gnu.org ([2001:470:142::17]:42960) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qM1JR-0004FY-B3 for submit@debbugs.gnu.org; Wed, 19 Jul 2023 03:09:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qM1JL-0000Ct-Sp for bug-gnu-emacs@gnu.org; Wed, 19 Jul 2023 03:09:23 -0400 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qM1JK-0007vv-8c for bug-gnu-emacs@gnu.org; Wed, 19 Jul 2023 03:09:23 -0400 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-4fb761efa7aso10654666e87.0 for ; Wed, 19 Jul 2023 00:09:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689750560; x=1690355360; h=mime-version:message-id:date:subject:to:from:from:to:cc:subject :date:message-id:reply-to; bh=JVWLaAoS6m+Y8i8Q3zE11YtBnhsEOR6H+dXjxYfbEjs=; b=gpaO0y1eyYPXiO0rSgBHfFRzt54EUliUaIvCuJTuFq7i/hsz8HZQnlWCYSNJgsrMGc OFP/X7O/Wjd0AYMuOCuG3osh0apIyMsLIifi9z7AM7j2Vq77gPf6S91fjzB/krlRBcDF z/L1xI7MNN88HWc/Ww1deYgSyQcEkHXqMFUgJMWDO9hmpYjie/kAs/RaSgbTnRmGIuYW tf+GaiSrevft7EdQi48b+Fkyj5dOs3VO+wFbW2dl47baPdHp9PICqow82ac/C2lyaX4p M7ozNjUqb2Nr46G100bTzwQRzgGBuC2TPbL3SvyVoomRKe6+CxZGW/mLow6AeD5yql+Q /6QQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689750560; x=1690355360; h=mime-version:message-id:date:subject:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=JVWLaAoS6m+Y8i8Q3zE11YtBnhsEOR6H+dXjxYfbEjs=; b=TCHb/dxJIOg3kpfsc1PwSP/mw3UtqVKMVmFKpLmxG1gfi9p0eExDN2CPE/qvNVjXZy /CirE6VkONmIH/+NOGfOIj13vFpXnD09PcEXkG0dVDPQdrJ2tkmdAOdwp6JjHyx0Z7FZ G+CdyU7Ew36PMiGq4kXSDA/Gpqny2Atc/5JUPOlYk9DIMuDre3Nmvr7U6jQywXU9AMTB CKWt2U9mdG5WWwbTc7W1xjZMOxgkNh89kI6q9vQG+MPFc7+M2ndahg53KwbT3fK1UATM ZUEObhZV79TUFoH4Yu/mUNivykBAqtaQQNjR5AgQlQxGUvJTptMwQLGa2Qlupp5qqlPc d5SA== X-Gm-Message-State: ABy/qLbR20X6IV+XmThI2wr5LiXQBnHTyAA1bYF+CpIpqGH2tHqHhmtT AZmhYxhtK1twaEvBOBO8YXSyxsOyNQc= X-Google-Smtp-Source: APBJJlH+9uEb5oxH7TW0WgYiPgiKdIq40fHmq9/MhbmTAaaTmWu9oywX+yoKu+FzN71L0JvtaUxBqw== X-Received: by 2002:ac2:58e9:0:b0:4f8:70d8:28f8 with SMTP id v9-20020ac258e9000000b004f870d828f8mr10702782lfo.55.1689750559584; Wed, 19 Jul 2023 00:09:19 -0700 (PDT) Received: from caladan ([212.46.176.29]) by smtp.gmail.com with ESMTPSA id bh17-20020a05600c3d1100b003fbb1ce274fsm5814556wmb.0.2023.07.19.00.09.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jul 2023 00:09:18 -0700 (PDT) From: Helmut Eller To: bug-gnu-emacs@gnu.org Subject: 30.0.50; set-face-foreground shows background colors Date: Wed, 19 Jul 2023 09:09:11 +0200 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2a00:1450:4864:20::12e; envelope-from=eller.helmut@gmail.com; helo=mail-lf1-x12e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --=-=-= Content-Type: text/plain 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: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=faces.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)) --=-=-= Content-Type: text/plain 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 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 19 08:43:57 2023 Received: (at 64725) by debbugs.gnu.org; 19 Jul 2023 12:43:57 +0000 Received: from localhost ([127.0.0.1]:55170 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qM6X6-0007Nk-Oe for submit@debbugs.gnu.org; Wed, 19 Jul 2023 08:43:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51918) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qM6X4-0007NW-Js for 64725@debbugs.gnu.org; Wed, 19 Jul 2023 08:43:55 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qM6Wx-0003wG-NT; Wed, 19 Jul 2023 08:43:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=DN4Gu1hMyzG16lpFnzbfXYxsfGBR3dimVyuzeiqv3JU=; b=YDhvO7/1wFy1 ycSZYSFXSemD31SFjQZ8wp9g7KIO6/+ICIAEuv3DCZBRY0ZK2AOAnazFrp9YPyOmXfLl+mTi+Mc57 eTHR76YQDLqfPXSRT7dOreSNLkjCpWFhdUfzEVylfnKpVVpKnOAmgDe47W9H1SBNWZIZiqbD+IDZy gcNe9FLoNZ0Q0rtMjCGNWAsMa2/9ssZYGG0r+hW5jPJpeTEkenUmHFkIHUQu9HqlGx2mDFK+Y+5Ez UyJ4UAiDQLKw+Qj5HmIl8u98scZ29PTYNAokBv8LUevoqd+/D9b6mSATgcuLkaepiAm24oMA5seij 4V+vl7bpC/KW7eiYI5av6g==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qM6Wt-0006AY-Hj; Wed, 19 Jul 2023 08:43:45 -0400 Date: Wed, 19 Jul 2023 15:44:10 +0300 Message-Id: <83351k5aw5.fsf@gnu.org> From: Eli Zaretskii To: Helmut Eller In-Reply-To: (message from Helmut Eller on Wed, 19 Jul 2023 09:09:11 +0200) Subject: Re: bug#64725: 30.0.50; set-face-foreground shows background colors References: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 64725 Cc: 64725@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Helmut Eller > 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. Why not use the actual foreground of the face being customized? Then the user could see whether the background color being selected will have good contrast (or just look well) with the face's foreground. From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 19 11:45:29 2023 Received: (at 64725) by debbugs.gnu.org; 19 Jul 2023 15:45:30 +0000 Received: from localhost ([127.0.0.1]:57003 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qM9Mn-0000rb-L2 for submit@debbugs.gnu.org; Wed, 19 Jul 2023 11:45:29 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:45458) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qM9Mj-0000rK-7a for 64725@debbugs.gnu.org; Wed, 19 Jul 2023 11:45:28 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-3fbc59de0e2so65973235e9.3 for <64725@debbugs.gnu.org>; Wed, 19 Jul 2023 08:45:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689781519; x=1690386319; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=e7Th5LJDCa5H+wmzghfx0lW71jC70ZPai+XwkyQ0a8o=; b=ASASj2yBrdevyt7RAug+bZHdIlQN4fpcMI0QRxGr6kmiilS9Y/5Q1fIZl69sLfZfds +5C99wHxHmXGPOTQM8efyuCKMpMC4hjuugeR3qVyaotzEoqJKagC7ueOHKjakwnuLbCz wNDKOZotODqEYlGiCGJXHZUnde6EchlgBZdmlUEfS+OgTNz5fG6XtTkvpwl2t0EtDoEp UaN97v2FQzMYjLv6NXNBK+Qm1ObjqwTqzZ/TLRijOBRfP7gjCH9ivya+LWSF0FmfBxuI DV3QAU3P86m03OZC671C6srxumL4DahkUQs7UpOi7kO9IGg/wxWeHGHOoOFTDdd8ToAI 2Xlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689781519; x=1690386319; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=e7Th5LJDCa5H+wmzghfx0lW71jC70ZPai+XwkyQ0a8o=; b=B6d/jC4A7AbbaQwIjXOWfhCg/iKOPD3j4nYP5mSQ0A+PKiE8350NdYEWEn8Fgcq4k3 w/EHq8Ok1Rt0fqZjVbkvX+k0PI6RZid2RgbyjADI1Rv9I8oehbsn3FMmCreAIaAWGD7E VKYNpIussdEW8IKrK/uF0Y6YV+RB2+W9rligJpjDHl3VMirI32EKp7bv9bybzuhjDbTk wcPB65/lLGPPNePG5sCCfzbL7xwp/1hKP6Z57NABUnIeC0sib84oJgL/6PQEDWRpcvtY PQwJBtNc6Z90kNuNFwQ3c8Wyym0qAJRDlMXxgppqbPFjgGbeMdrNGjtCrYST81QSGg49 4Y7Q== X-Gm-Message-State: ABy/qLYS2SBxr2CkRUIiKe9vghc7DtyK+REb6OOIlKBxkJ+W5W14PKZb VMz5YmS+KezJIMq5+rc3DsYh7sK01Eo= X-Google-Smtp-Source: APBJJlF+iRAqwdBf956+bi+igIWLl/SUgtEBW6pJavQawga9epdJHHJPZ5EpfSlwJxfgMyb1WOGiLw== X-Received: by 2002:a7b:cbd6:0:b0:3fd:45b:45f8 with SMTP id n22-20020a7bcbd6000000b003fd045b45f8mr1629603wmi.23.1689781518538; Wed, 19 Jul 2023 08:45:18 -0700 (PDT) Received: from caladan ([212.46.176.29]) by smtp.gmail.com with ESMTPSA id i12-20020adffdcc000000b003142e438e8csm5630843wrs.26.2023.07.19.08.45.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jul 2023 08:45:18 -0700 (PDT) From: Helmut Eller To: Eli Zaretskii Subject: Re: bug#64725: 30.0.50; set-face-foreground shows background colors In-Reply-To: <83351k5aw5.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 19 Jul 2023 15:44:10 +0300") References: <83351k5aw5.fsf@gnu.org> Date: Wed, 19 Jul 2023 17:45:17 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 64725 Cc: 64725@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Wed, Jul 19 2023, Eli Zaretskii wrote: >> It would be more useful to see the text with the candidate color as >> foreground on the default background. > > Why not use the actual foreground of the face being customized? Then > the user could see whether the background color being selected will > have good contrast (or just look well) with the face's foreground. I don't understand what you mean with "actual foreground". The problem I have, is that some color combinations are hard to read, like yellow on white. Then I usually want to change the foreground color and not the background. Assume that we have white as default background, black as default foreground, font-lock-string-face has foreground yellow and we want to change the foreground from yellow to brown. In this situation I would like to see how brown on white would look and not so much black on brown (or white on brown). Even better then displaying the candidate color on the default background would be to show the candidate color on the current background color of the face. But I guess that's harder to implement. Helmut From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 19 12:25:58 2023 Received: (at 64725) by debbugs.gnu.org; 19 Jul 2023 16:25:59 +0000 Received: from localhost ([127.0.0.1]:57045 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qM9zy-0001w7-L0 for submit@debbugs.gnu.org; Wed, 19 Jul 2023 12:25:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36428) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qM9zw-0001vu-Up for 64725@debbugs.gnu.org; Wed, 19 Jul 2023 12:25:57 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qM9zr-0002WZ-On; Wed, 19 Jul 2023 12:25:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=sEEfviGdfI4MK2MXNVnSS+NcvfH88dTV/aF0e+fw8pY=; b=WIQ5oBYMCBNK 9VFkkSwRg98NUPjRUxAAvcQwR6GMPsnaBZFvFzEbmNomra9G4Gy9LCI5bPdelltecDEoBiGN192TO 6luFliDk9rn5MJ1cyJ/8VQR9E5HU5B6pJw0es6RHtg7KkBxcODBiALt1PD2oFhLhsv/NaAPz2UnpV QTZ8ABaf8v5K+gptpfPPg4d1G2nk5u+NagOfYG2zl5GXSnFlWbTbJ/7xGkuONxq4nchY/Ms7aEiHl LFuIsDvPh57PPq2BttTwVqFYizEN/anzdnMmGgR0wERWpHCu5T+D+YgrYHkNSDooVtD0b+NElAhds EbiYc/lv/PZRLIltrQwJZw==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qM9zq-0007m3-9Y; Wed, 19 Jul 2023 12:25:51 -0400 Date: Wed, 19 Jul 2023 19:26:21 +0300 Message-Id: <83lefb50lu.fsf@gnu.org> From: Eli Zaretskii To: Helmut Eller In-Reply-To: (message from Helmut Eller on Wed, 19 Jul 2023 17:45:17 +0200) Subject: Re: bug#64725: 30.0.50; set-face-foreground shows background colors References: <83351k5aw5.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 64725 Cc: 64725@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Helmut Eller > Cc: 64725@debbugs.gnu.org > Date: Wed, 19 Jul 2023 17:45:17 +0200 > > On Wed, Jul 19 2023, Eli Zaretskii wrote: > > >> It would be more useful to see the text with the candidate color as > >> foreground on the default background. > > > > Why not use the actual foreground of the face being customized? Then > > the user could see whether the background color being selected will > > have good contrast (or just look well) with the face's foreground. > > I don't understand what you mean with "actual foreground". > [...] > Even better then displaying the candidate color on the default > background would be to show the candidate color on the current > background color of the face. But I guess that's harder to implement. 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. From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 20 10:34:45 2023 Received: (at 64725) by debbugs.gnu.org; 20 Jul 2023 14:34:45 +0000 Received: from localhost ([127.0.0.1]:59441 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qMUjs-0003vE-KM for submit@debbugs.gnu.org; Thu, 20 Jul 2023 10:34:45 -0400 Received: from mail-lj1-x230.google.com ([2a00:1450:4864:20::230]:53728) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qMUjq-0003v0-8X for 64725@debbugs.gnu.org; Thu, 20 Jul 2023 10:34:44 -0400 Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-2b9540031acso12568601fa.3 for <64725@debbugs.gnu.org>; Thu, 20 Jul 2023 07:34:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689863676; x=1690468476; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=dRU9qqCk+AhCIxe+hVEKjDT9ieLioI8A42A5wEdcYyY=; b=Dr5KS2ZYWlLXD0PPWeh+aoPTK3YoRq9N87uTxp5h9W55KcWr/1PyTXxUxz0OZG8bKk Ba784/KbBib+2BdaJotdrXJYgX7sGpG/wLyVE/Gwn5k8pMcFH5SA1iOyAR7Qs8z580Sz oqH4L5k9xvSPR13+P9fv1PFlz4xOJMAo3R+1WlV/+2sq61W0LmRINs3VnytGtfSsQeLc uVYEYW5yMGwDH2KgqDXGUn6CsBsxA6tj0z1OIvCuEzAKzN/0AN7X/UF5cLq/d0HuETmS dUKc0ZVRRSBytZMwYoWPpeydAvMkkWegjiOH3c0wxZdiqujjLjBb8CfsLUAyEfXhSwXj CGIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689863676; x=1690468476; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=dRU9qqCk+AhCIxe+hVEKjDT9ieLioI8A42A5wEdcYyY=; b=CXHsh7E34wcKBUqUzOxQt1OJ9Rvvj5y6WJUihvBMAyEzkTj9y8FYF0voRxrNz10Fnz VkuEB9sm0XxaTFc8P46YYXvH/sqPCEfZ8whkiPfyjP5uVVubbKJQCTxZLmaTI7K4dQfc av1xeBVYmDSRDu+1ix10aJf9VWhIf5sYAGzzkZTG4eWslUgspVe7Y/SA+c9QGp9Z1rQI 0T+9IX9nVLE+FczqwVlxLr+9BFHnoIz5+PADI6PMu/GOzT6CLy/cyEm2ZUtc0I5RR4tH 8YHDQtzkAmZH7jFgBDdZT5qaKlcWz8PgLwJUZPajznEPqQnZ9ks6vDjxGOAoaCHynJMy /O+g== X-Gm-Message-State: ABy/qLYEgomaXj4kwxJC1g5CUF66b4gq72MfuNeLFh2sKlcocL3DvH59 ZcrZ3U2VRVnRCsC5ARMLUWYSDuESeLg= X-Google-Smtp-Source: APBJJlF5ETni1XYNTyOQ86zW3i0i1E7XA7N6PvyXNuxe5AuDv23A8iLIDvpdVEd+xm9vtoELyjuFHw== X-Received: by 2002:ac2:4db7:0:b0:4fd:d9e0:4d79 with SMTP id h23-20020ac24db7000000b004fdd9e04d79mr1837786lfe.6.1689863675645; Thu, 20 Jul 2023 07:34:35 -0700 (PDT) Received: from caladan ([212.46.176.29]) by smtp.gmail.com with ESMTPSA id l14-20020a1c790e000000b003fc3b03caa4sm4383085wme.0.2023.07.20.07.34.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jul 2023 07:34:34 -0700 (PDT) From: Helmut Eller To: Eli Zaretskii Subject: Re: bug#64725: 30.0.50; set-face-foreground shows background colors In-Reply-To: <83lefb50lu.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 19 Jul 2023 19:26:21 +0300") References: <83351k5aw5.fsf@gnu.org> <83lefb50lu.fsf@gnu.org> Date: Thu, 20 Jul 2023 16:34:34 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 64725 Cc: 64725@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain 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: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Improve-the-interactive-use-of-set-face-foreground.patch >From 69159b5ca0123692373a014ed19e01547c12449e Mon Sep 17 00:00:00 2001 From: Helmut Eller Date: Thu, 20 Jul 2023 16:27:34 +0200 Subject: [PATCH] Improve the interactive use of set-face-foreground When displaying the completion candidates, show how the face would look with the new foreground. * lisp/faces.el (faces--string-with-color): New helper. Factored out from defined-colors-with-face-attributes. (defined-colors-with-face-attributes): Use it. (read-color): Add optional argument FACE and pass it to faces--string-with-color. (read-face-attribute): Call read-color with more appropriate foreground and face arguments. * doc/lispref/minibuf.texi (High-Level Completion): Describe the intention behind the arguments FOREGROUND and FACE of read-color. --- doc/lispref/minibuf.texi | 8 ++++- lisp/faces.el | 64 +++++++++++++++++++++++++--------------- 2 files changed, 48 insertions(+), 24 deletions(-) diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi index a861b8e910b..12ea7b12386 100644 --- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi @@ -1515,7 +1515,8 @@ High-Level Completion @code{commandp}. @end defun -@deffn Command read-color &optional prompt convert allow-empty display +@deffn Command read-color &optional prompt convert allow-empty @ + display foreground face This function reads a string that is a color specification, either the color's name or an RGB hex value such as @code{#RRRGGGBBB}. It prompts with @var{prompt} (default: @code{"Color (name or #RGB triplet):"}) @@ -1535,6 +1536,11 @@ High-Level Completion Interactively, or when @var{display} is non-@code{nil}, the return value is also displayed in the echo area. + +The optional arguments FOREGROUND and FACE control the appearence of +the completion candidates. The candidates are displayed like FACE but +with different colors. If FOREGROUND is non-@code{nil} the foreground +varies, otherwise the background. @end deffn See also the functions @code{read-coding-system} and diff --git a/lisp/faces.el b/lisp/faces.el index 44d64c743ba..4f51a031156 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 face))) (if (equal (string-trim color) "") default color)) @@ -1870,15 +1871,26 @@ defined-colors-with-face-attributes strings with text properties, that make the color names render with the color they represent as background color (if FOREGROUND is nil; otherwise use the foreground color)." - (mapcar - (lambda (color-name) - (let ((color (copy-sequence color-name))) - (propertize color 'face - (if foreground - (list :foreground color) - (list :foreground (readable-foreground-color color-name) - :background color))))) - (defined-colors frame))) + (mapcar (lambda (color-name) + (faces--string-with-color color-name color-name foreground)) + (defined-colors frame))) + +(defun faces--string-with-color (string color &optional foreground face) + "Return a copy of STRING with face attributes for COLOR. +Set the :background or :foreground attribute to COLOR, depending +on the argument FOREGROUND. + +The optional FACE argument controls the values for other +attributes." + (let* ((defaults (if face (list face) '())) + (colors (cond (foreground + (list :foreground color)) + (face + (list :background color)) + (t + (list :foreground (readable-foreground-color color) + :background color))))) + (propertize string 'face (cons colors defaults)))) (defun readable-foreground-color (color) "Return a readable foreground color for background COLOR. @@ -1987,7 +1999,7 @@ display-grayscale-p (> (tty-color-gray-shades display) 2))) (defun read-color (&optional prompt convert-to-RGB allow-empty-name msg - foreground) + foreground face) "Read a color name or RGB triplet. Completion is available for color names, but not for RGB triplets. @@ -2016,17 +2028,23 @@ read-color Interactively, or with optional arg MSG non-nil, print the resulting color name in the echo area. -Interactively, displays a list of colored completions. If optional -argument FOREGROUND is non-nil, shows them as foregrounds, otherwise -as backgrounds." +Interactively, displays a list of colored completions. If +optional argument FOREGROUND is non-nil, shows them as +foregrounds, otherwise as backgrounds. The optional argument +FACE controls the default appearance." (interactive "i\np\ni\np") ; Always convert to RGB interactively. (let* ((completion-ignore-case t) - (colors (append '("foreground at point" "background at point") - (if allow-empty-name '("")) - (if (display-color-p) - (defined-colors-with-face-attributes - nil foreground) - (defined-colors)))) + (color-alist + `(("foreground at point" . ,(foreground-color-at-point)) + ("background at point" . ,(background-color-at-point)) + ,@(if allow-empty-name '(("" . unspecified))) + ,@(mapcar (lambda (c) (cons c c)) (defined-colors)))) + (colors (mapcar (lambda (pair) + (let* ((name (car pair)) + (color (cdr pair))) + (faces--string-with-color name color + foreground face))) + color-alist)) (color (completing-read (or prompt "Color (name or #RGB triplet): ") ;; Completing function for reading colors, accepting -- 2.39.2 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 03 03:58:04 2023 Received: (at 64725-done) by debbugs.gnu.org; 3 Aug 2023 07:58:04 +0000 Received: from localhost ([127.0.0.1]:50682 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qRTDf-0004Tp-UI for submit@debbugs.gnu.org; Thu, 03 Aug 2023 03:58:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50260) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qRTDe-0004T9-5Y for 64725-done@debbugs.gnu.org; Thu, 03 Aug 2023 03:58:02 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qRTDY-0001iT-UW; Thu, 03 Aug 2023 03:57:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=HMJDp0dfPgPGQU5Ol3jpWUEbpvjKPPS17rWdtyNke6g=; b=LaT58GMcE3Hu XRi1a5bonsgHOp5LAZAy1bTBKkJ8SYOfiRtZX4vCdSv2oaxUjz/lICW57XMCHBIPcqhTEZaL+0g41 3wGg0dLQaJ0IIPyXIdHUzwxYTteQ+thpM5InnqovqerixcRreCt0zNtMbFpIANHPyBnO2ZEKUfO0L 4LLG+vJe4xqe1jywRMcnmQIh2Eoa3RVWL+RcvbbOCUcOhbiN54qO95yuUF+3QeIuNMV8Vi2KfiraL 5xGN05KN8MsQt1YWrw8pT9qJY/AfYSIRlnTX5s1XpP1Fl/iQWh1O0cQuH38LEl+jCc2G2tC+03EuE ym68vzTUzKv4FsYyIu6yNQ==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qRTDX-0005xs-9l; Thu, 03 Aug 2023 03:57:55 -0400 Date: Thu, 03 Aug 2023 10:58:03 +0300 Message-Id: <83y1isy2us.fsf@gnu.org> From: Eli Zaretskii To: Helmut Eller In-Reply-To: (message from Helmut Eller on Thu, 20 Jul 2023 16:34:34 +0200) Subject: Re: bug#64725: 30.0.50; set-face-foreground shows background colors References: <83351k5aw5.fsf@gnu.org> <83lefb50lu.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 64725-done Cc: 64725-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Helmut Eller > 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. From unknown Tue Jun 17 20:17:56 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 31 Aug 2023 11:24:07 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator