From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tina Russell Newsgroups: gmane.emacs.bugs Subject: bug#34001: 26.1.90; :distant-foreground face property fails to work in most cases Date: Sat, 19 Jan 2019 19:20:16 -0800 Message-ID: References: <87a7k1l88w.fsf@gmail.com> NNTP-Posting-Host: ciao.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Trace: ciao.gmane.org 1547954465 6605 195.159.176.228 (20 Jan 2019 03:21:05 GMT) X-Complaints-To: usenet@ciao.gmane.org NNTP-Posting-Date: Sun, 20 Jan 2019 03:21:05 +0000 (UTC) Cc: 34001@debbugs.gnu.org To: Federico Tedin Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jan 20 04:21:03 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1gl3fS-0001iA-8Z for geb-bug-gnu-emacs@m.gmane.org; Sun, 20 Jan 2019 04:21:02 +0100 Original-Received: from localhost ([127.0.0.1]:34679 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gl3fb-00080L-5v for geb-bug-gnu-emacs@m.gmane.org; Sat, 19 Jan 2019 22:21:11 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:35821) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gl3fT-0007zC-JR for bug-gnu-emacs@gnu.org; Sat, 19 Jan 2019 22:21:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gl3fS-0002gA-Ig for bug-gnu-emacs@gnu.org; Sat, 19 Jan 2019 22:21:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38936) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gl3fS-0002ft-9l for bug-gnu-emacs@gnu.org; Sat, 19 Jan 2019 22:21:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gl3fR-0004Si-U1 for bug-gnu-emacs@gnu.org; Sat, 19 Jan 2019 22:21:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Tina Russell Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 20 Jan 2019 03:21:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34001 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 34001-submit@debbugs.gnu.org id=B34001.154795443717100 (code B ref 34001); Sun, 20 Jan 2019 03:21:01 +0000 Original-Received: (at 34001) by debbugs.gnu.org; 20 Jan 2019 03:20:37 +0000 Original-Received: from localhost ([127.0.0.1]:38217 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gl3f2-0004Rk-IP for submit@debbugs.gnu.org; Sat, 19 Jan 2019 22:20:36 -0500 Original-Received: from mail-lj1-f175.google.com ([209.85.208.175]:42634) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gl3f0-0004RW-FS for 34001@debbugs.gnu.org; Sat, 19 Jan 2019 22:20:35 -0500 Original-Received: by mail-lj1-f175.google.com with SMTP id l15-v6so14745677lja.9 for <34001@debbugs.gnu.org>; Sat, 19 Jan 2019 19:20:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=STqH1sLX25/kBb4idgxwJGFUKnAavj8s53wTHMxgJfU=; b=t/4ShXAAm6mUKp2B485xOfAzRklZgP6OOVBEhKyAvm6VDBrz4dO+XEyq7af64ZnsFR VnFyG7+Ya0VSaBYlNJcrl+yfQDsdTBjqxyW4dc1s875cohpHyxRnUX/092ZpX9tYivyX Qv50vKXQH5RRybDc6A4Nbnjyc0khfze8AbqkzMi8Q8bmNamz9WsjlxAHh6uJ1ffG8yLs r1uhsDyorDleHDxOMupRs8AiOhwOgwLPsyGYQIImavtuI8ya8gpr50hpBwhxj8e/YZFe 8DaE7gp8yE7IBhBRuEMm0n9E1u6CzQ2YrT2VqEFVTsu7VsxLqwzBcUU3i+x5JYFAE3l+ 74dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=STqH1sLX25/kBb4idgxwJGFUKnAavj8s53wTHMxgJfU=; b=JjXdZxGlnx0MGtmW9mVSvmZvIS6xYWzBnuMv7zH+2vHN/vy3tQaNHc4dJnh+WWuhDT b740pZrwneXm/NtnwzuAgRLrbQppkrLilE+klzNctZCf1YyZQwopDaFVVL22PjTyv1Wl BIozIMx5EpF7NsofmlA8/QLtmQuxMSUfHndST4yysNcZFd2XZZmLuWVtuZEDEDQPHkMZ DvFNuEZ7G8YjCbVXjQz5THCcRQNO1jJ27K3uUeTdz0KG4OF3EiGyliDzt7G5UOVi2zG8 zuyMndrbQ5xJqBV2+ftymCtPFzVDCLsESuVYmchZ3HxQxR/hXXJPDWQxQ2UYVFWDFMau NjlA== X-Gm-Message-State: AJcUukca/58f3Pf8b8GjYk7jUb17Pr7UOf1Wx+5fu6RO+HlDGN3eUZwb xy1u1jadVNEraWFxi5Z0M7+XU/ySQFFBrAuhAB4= X-Google-Smtp-Source: ALg8bN6xuW9A9B1r5bfUAUIaHq6f7idF8vvgTI5w4Y9x89Vbr4t36GHccpFsEhlhqUN/IMlDATMy7ufmv9BTjjZxF70= X-Received: by 2002:a2e:5109:: with SMTP id f9-v6mr16163286ljb.52.1547954428316; Sat, 19 Jan 2019 19:20:28 -0800 (PST) In-Reply-To: <87a7k1l88w.fsf@gmail.com> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:154602 Archived-At: Well, even if we change the backend for how color distance is measured, we=E2=80=99ll probably still need a user option for =E2=80=9Chow = much color distance is required for two colors to be considered appropriately distant,=E2=80=9D so it seems like a good place to start in any event. Thanks! On Tue, Jan 15, 2019 at 5:08 PM Federico Tedin wr= ote: > > Tina Russell writes: > > > :distant-foreground is a very useful concept for a face property: text > > will be rendered with the :foreground color, unless it=E2=80=99s too cl= ose to > > the current background color, in which case :distant-foreground kicks > > in. Like, try this in Eshell or IELM: > > > > (propertize "Greetings, esteemed Emacs developers!" 'face '(:foreground > > "yellow" :background "yellow")) > > > > You=E2=80=99ll get a solid band of yellow, of course. But, with > > :distant-foreground=E2=80=A6 > > > > (propertize "Greetings, esteemed Emacs developers!" 'face '(:foreground > > "yellow" :background "yellow" :distant-foreground "black")) > > > > Now it is a friendly greeting. (Naturally, you wouldn=E2=80=99t normall= y set > > :background and :distant-foreground in the same face, this is just an > > example.) > > > > But, try this: > > > > (propertize "Greetings, esteemed Emacs developers!" 'face '(:foreground > > "yellow" :background "white" :distant-foreground "black")) > > > > :distant-foreground doesn=E2=80=99t kick in=E2=80=94and you=E2=80=99re = left with yellow-on-white > > text that=E2=80=99s impossible to read, the exact scenario that > > :distant-foreground was quite rightly designed to avoid. > > > > I=E2=80=99m not the only one who=E2=80=99s noticed this; there=E2=80=99= s a good StackExchange > > thread from 2015 here: > > https://emacs.stackexchange.com/questions/7982/ The author notes that > > there should be a user option to set the amount of =E2=80=9Cdistance=E2= =80=9D (between > > foreground and background colors) that is required for > > distant-foreground to kick in, and adds that a good way to measure > > color distance in real-world circumstances is described here: > > http://web.mst.edu/~rhall/web_design/color_readability.html A commenter > > suggested that he file a bug, but I can=E2=80=99t find an Emacs bug rep= ort > > related to this issue, so I=E2=80=99m filing this now. > > > > I really hope this gets addressed, because :distant-foreground is a > > really nice and clever feature. Thanks! > > > > In GNU Emacs 26.1.90 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.22.3= 0) > > of 2019-01-02 built on pannychis > > Repository revision: 08840f2f7bfc6144bd163dd85efe87d28541e425 > > Windowing system distributor 'The X.Org Foundation', version 11.0.11906= 000 > > System Description: Ubuntu 18.04.1 LTS > > > > Configured using: > > 'configure --with-xaw3d --with-modules --with-xwidgets' > > I've created a patch that introduces a new variable > `face-near-same-color-threshold', with a default value of 30000 (as was > defined in NEAR_SAME_COLOR_THRESHOLD in xfaces.c). Changing this > variable's value will make certain color combinations be considered as > 'same', which will lead to :distant-foreground being used. For example: > > M-: (setq face-near-same-color-threshold 200000) > M-: (clear-font-cache) > > Then, using your third example, the text will be displayed with a black > foregound. > > Is this a reasonable fix, or should we consider implementing another way > of measuring distance between colors like Tina mentioned? >