unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Tina Russell <tinakellyrussell@gmail.com>
To: Federico Tedin <federicotedin@gmail.com>
Cc: 34001@debbugs.gnu.org
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	[thread overview]
Message-ID: <CAJBHbT6N7patbHAi5yk6-qHw7rb+FngqY+p9oMUYVy5T=e06aQ@mail.gmail.com> (raw)
In-Reply-To: <87a7k1l88w.fsf@gmail.com>

Well, even if we change the backend for how color distance is
measured, we’ll probably still need a user option for “how much color
distance is required for two colors to be considered appropriately
distant,” so it seems like a good place to start in any event.

Thanks!

On Tue, Jan 15, 2019 at 5:08 PM Federico Tedin <federicotedin@gmail.com> wrote:
>
> Tina Russell <tinakellyrussell@gmail.com> writes:
>
> > :distant-foreground is a very useful concept for a face property: text
> > will be rendered with the :foreground color, unless it’s too close 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’ll get a solid band of yellow, of course. But, with
> > :distant-foreground…
> >
> > (propertize "Greetings, esteemed Emacs developers!" 'face '(:foreground
> > "yellow" :background "yellow" :distant-foreground "black"))
> >
> > Now it is a friendly greeting. (Naturally, you wouldn’t normally 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’t kick in—and you’re left with yellow-on-white
> > text that’s impossible to read, the exact scenario that
> > :distant-foreground was quite rightly designed to avoid.
> >
> > I’m not the only one who’s noticed this; there’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 “distance” (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’t find an Emacs bug report
> > related to this issue, so I’m 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.30)
> >  of 2019-01-02 built on pannychis
> > Repository revision: 08840f2f7bfc6144bd163dd85efe87d28541e425
> > Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
> > 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?
>





  reply	other threads:[~2019-01-20  3:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-06 22:31 bug#34001: 26.1.90; :distant-foreground face property fails to work in most cases Tina Russell
2019-01-16  1:08 ` Federico Tedin
2019-01-20  3:20   ` Tina Russell [this message]
2019-01-20 17:15     ` Federico Tedin
2019-03-01  8:40   ` Eli Zaretskii
2019-03-01 12:44     ` Federico Tedin
2019-03-01 13:48       ` Eli Zaretskii
2019-01-21 22:58 ` Basil L. Contovounesios
2019-01-21 23:09   ` Daniel Colascione

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='CAJBHbT6N7patbHAi5yk6-qHw7rb+FngqY+p9oMUYVy5T=e06aQ@mail.gmail.com' \
    --to=tinakellyrussell@gmail.com \
    --cc=34001@debbugs.gnu.org \
    --cc=federicotedin@gmail.com \
    /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).