unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#16969: Isearch: lazy-highlight face sometimes has foreground and background the same colour.
@ 2014-03-08 18:35 Alan Mackenzie
  2014-03-08 21:55 ` Juri Linkov
  0 siblings, 1 reply; 10+ messages in thread
From: Alan Mackenzie @ 2014-03-08 18:35 UTC (permalink / raw)
  To: 16969

Hi, Emacs.

In isearch.el, the face `lazy-highlight' is defined with only a
:background colour, e.g. turquoise3.  On a Linux tty, this is cyan.

When the text which has a lazy match itself has a cyan foreground
colour, the lazy highlighting leaves the cyan text on a cyan background
invisible.  This happens, for example, on the Linux tty when searching
through an Info menu.  This is surely a bug.

An effective solution would be to give the `lazy-highlight' face a
foreground colour, e.g. black.

-- 
Alan Mackenzie (Nuremberg, Germany).





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

* bug#16969: Isearch: lazy-highlight face sometimes has foreground and background the same colour.
  2014-03-08 18:35 bug#16969: Isearch: lazy-highlight face sometimes has foreground and background the same colour Alan Mackenzie
@ 2014-03-08 21:55 ` Juri Linkov
  2014-03-08 23:01   ` Alan Mackenzie
                     ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Juri Linkov @ 2014-03-08 21:55 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: 16969

> An effective solution would be to give the `lazy-highlight' face a
> foreground colour, e.g. black.

It's useful to keep the foreground color to help seeing the context
especially when a match is highlighted on a font-look foreground.

But the problem needs to be fixed anyway.  So maybe we could add the
face attribute :distant-foreground to the `lazy-highlight' face
that could be applied only when the background color is near to the
foreground color like a cyan foreground on a cyan background.





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

* bug#16969: Isearch: lazy-highlight face sometimes has foreground and background the same colour.
  2014-03-08 21:55 ` Juri Linkov
@ 2014-03-08 23:01   ` Alan Mackenzie
  2014-03-09  9:37     ` Jan Djärv
  2014-03-09  0:45   ` Daniel Colascione
  2022-02-05 22:46   ` Lars Ingebrigtsen
  2 siblings, 1 reply; 10+ messages in thread
From: Alan Mackenzie @ 2014-03-08 23:01 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 16969

Hi, Juri.

On Sat, Mar 08, 2014 at 11:55:45PM +0200, Juri Linkov wrote:
> > An effective solution would be to give the `lazy-highlight' face a
> > foreground colour, e.g. black.

> It's useful to keep the foreground color to help seeing the context
> especially when a match is highlighted on a font-look foreground.

Yes.

> But the problem needs to be fixed anyway.  So maybe we could add the
> face attribute :distant-foreground to the `lazy-highlight' face
> that could be applied only when the background color is near to the
> foreground color like a cyan foreground on a cyan background.

I don't know what ":distant-foreground" means.  It doesn't seem to be in
the Elisp manual.

-- 
Alan Mackenzie (Nuremberg, Germany).





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

* bug#16969: Isearch: lazy-highlight face sometimes has foreground and background the same colour.
  2014-03-08 21:55 ` Juri Linkov
  2014-03-08 23:01   ` Alan Mackenzie
@ 2014-03-09  0:45   ` Daniel Colascione
  2014-03-09 21:43     ` Juri Linkov
  2014-03-10  3:01     ` Stefan Monnier
  2022-02-05 22:46   ` Lars Ingebrigtsen
  2 siblings, 2 replies; 10+ messages in thread
From: Daniel Colascione @ 2014-03-09  0:45 UTC (permalink / raw)
  To: Juri Linkov, Alan Mackenzie; +Cc: 16969

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

On 03/08/2014 01:55 PM, Juri Linkov wrote:
>> An effective solution would be to give the `lazy-highlight' face a
>> foreground colour, e.g. black.
> 
> It's useful to keep the foreground color to help seeing the context
> especially when a match is highlighted on a font-look foreground.
> 
> But the problem needs to be fixed anyway.  So maybe we could add the
> face attribute :distant-foreground to the `lazy-highlight' face
> that could be applied only when the background color is near to the
> foreground color like a cyan foreground on a cyan background

And what? Are we going to apply distant-foreground to everything and
hope that the color we choose is legible in whatever theme the user has?
We really need automatic contrast adjustment, not one-off fixes.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]

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

* bug#16969: Isearch: lazy-highlight face sometimes has foreground and background the same colour.
  2014-03-08 23:01   ` Alan Mackenzie
@ 2014-03-09  9:37     ` Jan Djärv
  2014-03-09 13:25       ` Alan Mackenzie
  0 siblings, 1 reply; 10+ messages in thread
From: Jan Djärv @ 2014-03-09  9:37 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: 16969

Hi.


Alan Mackenzie skrev 2014-03-09 00:01:
> Hi, Juri.
>
> On Sat, Mar 08, 2014 at 11:55:45PM +0200, Juri Linkov wrote:
>>> An effective solution would be to give the `lazy-highlight' face a
>>> foreground colour, e.g. black.
>
>> It's useful to keep the foreground color to help seeing the context
>> especially when a match is highlighted on a font-look foreground.
>
> Yes.
>
>> But the problem needs to be fixed anyway.  So maybe we could add the
>> face attribute :distant-foreground to the `lazy-highlight' face
>> that could be applied only when the background color is near to the
>> foreground color like a cyan foreground on a cyan background.
>
> I don't know what ":distant-foreground" means.  It doesn't seem to be in
> the Elisp manual.

You can't have looked very hard.

Faces => Face attributes:

`:distant-foreground'
      Alternative foreground color, a string.  This is like `:foreground'
      but the color is only used as a foreground when the background
      color is near to the foreground that would have been used.  This
      is useful for example when marking text (i.e. the region face).
      If the text has a foreground that is visible with the region face,
      that foreground is used.  If the foreground is near the region
      face background, `:distant-foreground' is used instead so the text
      is readable.


	Jan D.





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

* bug#16969: Isearch: lazy-highlight face sometimes has foreground and background the same colour.
  2014-03-09  9:37     ` Jan Djärv
@ 2014-03-09 13:25       ` Alan Mackenzie
  0 siblings, 0 replies; 10+ messages in thread
From: Alan Mackenzie @ 2014-03-09 13:25 UTC (permalink / raw)
  To: Jan Djärv; +Cc: 16969

On Sun, Mar 09, 2014 at 10:37:48AM +0100, Jan Djärv wrote:
> Hi.


> Alan Mackenzie skrev 2014-03-09 00:01:

> > I don't know what ":distant-foreground" means.  It doesn't seem to be in
> > the Elisp manual.

> You can't have looked very hard.

:-).  It was late at night.  I had the release version of the Elisp
manual open, not the trunk version.

> Faces => Face attributes:

> `:distant-foreground'
>       Alternative foreground color, a string.  This is like `:foreground'
>       but the color is only used as a foreground when the background
>       color is near to the foreground that would have been used.  This
>       is useful for example when marking text (i.e. the region face).
>       If the text has a foreground that is visible with the region face,
>       that foreground is used.  If the foreground is near the region
>       face background, `:distant-foreground' is used instead so the text
>       is readable.

Thanks!

> 	Jan D.

-- 
Alan Mackenzie (Nuremberg, Germany).





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

* bug#16969: Isearch: lazy-highlight face sometimes has foreground and background the same colour.
  2014-03-09  0:45   ` Daniel Colascione
@ 2014-03-09 21:43     ` Juri Linkov
  2014-03-09 22:20       ` Drew Adams
  2014-03-10  3:01     ` Stefan Monnier
  1 sibling, 1 reply; 10+ messages in thread
From: Juri Linkov @ 2014-03-09 21:43 UTC (permalink / raw)
  To: Daniel Colascione; +Cc: Alan Mackenzie, 16969

>> But the problem needs to be fixed anyway.  So maybe we could add the
>> face attribute :distant-foreground to the `lazy-highlight' face
>> that could be applied only when the background color is near to the
>> foreground color like a cyan foreground on a cyan background
>
> And what? Are we going to apply distant-foreground to everything and
> hope that the color we choose is legible in whatever theme the user has?

We need to guarantee that default faces don't produce illegible
combinations of foreground and background colors.  This can be achieved
by using :distant-foreground on the default face definition.
A user redefining the face can also manually adjust :distant-foreground
to use another color if the user doesn't like the default color
used when the distance is more than the threshold.

> We really need automatic contrast adjustment, not one-off fixes.

Automatic contrast adjustment is useful too when the user has no preference
for a color to use instead of an illegible color and want to adjust all
such colors automatically.  There is a request in bug#16974 for this feature.





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

* bug#16969: Isearch: lazy-highlight face sometimes has foreground and background the same colour.
  2014-03-09 21:43     ` Juri Linkov
@ 2014-03-09 22:20       ` Drew Adams
  0 siblings, 0 replies; 10+ messages in thread
From: Drew Adams @ 2014-03-09 22:20 UTC (permalink / raw)
  To: Juri Linkov, Daniel Colascione; +Cc: Alan Mackenzie, 16969

> We need to guarantee that default faces don't produce
> illegible combinations of foreground and background colors.

Yes, that is the _only_ *need* here.  It is the need raised
by the bug.

And the simplest and most foolproof way to fulfill that need and
fix the bug is to simply give face `lazy-highlight', by default,
a black/white foreground for a light/dark background mode.

Just as we do already for face `isearch', and just as we have
always done.  That should have been done for `lazy-highlight'
long ago.  End of story.

Any user who wants to fiddle with the new "feature" that lets
other highlighting show through and tries to adjust colors
automatically can always customize these search-hit faces to get
that new effect.  There is no reason to impose this gimmick on
Emacs users now by _default_.

Today's flashy new feature is too often tomorrow's out-of-fashion
annoyance.  Just stick with what is simple and has always worked
well.  If, after a few years, we find that _most users choose_ to
customize to get the new effect, we can then turn it on by default.
There is no reason to jump to that now.

It amazes me that it took so long and was such a bloody battle to
get something like `transient-mark-mode' turned on by default,
even though users commonly customized Emacs for decades to turn it
on, and yet you are ready to willy nilly change longstanding
default behavior such as this before the new behavior has even
been offered as a possibility for users to _choose_.  It hasn't
even been released yet, and you already want to make it the default.

First things first: turn on `delete-selection-mode' by default,
why dontcha?  And offer this new highlighting style as an
_option_ for now: opt in, not opt out, for the new.

Consider making it the default behavior only later, after you have
had a chance to see how many users actually choose it.  Don't get
carried away by your enthusiasm for your shiny new object.





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

* bug#16969: Isearch: lazy-highlight face sometimes has foreground and background the same colour.
  2014-03-09  0:45   ` Daniel Colascione
  2014-03-09 21:43     ` Juri Linkov
@ 2014-03-10  3:01     ` Stefan Monnier
  1 sibling, 0 replies; 10+ messages in thread
From: Stefan Monnier @ 2014-03-10  3:01 UTC (permalink / raw)
  To: Daniel Colascione; +Cc: Alan Mackenzie, 16969

> And what? Are we going to apply distant-foreground to everything and
> hope that the color we choose is legible in whatever theme the user has?

For now, yes.

> We really need automatic contrast adjustment, not one-off fixes.

Not sure about "really", but I agree it's a desirable feature.  But it
won't be in 24.4.


        Stefan





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

* bug#16969: Isearch: lazy-highlight face sometimes has foreground and background the same colour.
  2014-03-08 21:55 ` Juri Linkov
  2014-03-08 23:01   ` Alan Mackenzie
  2014-03-09  0:45   ` Daniel Colascione
@ 2022-02-05 22:46   ` Lars Ingebrigtsen
  2 siblings, 0 replies; 10+ messages in thread
From: Lars Ingebrigtsen @ 2022-02-05 22:46 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Alan Mackenzie, 16969

Juri Linkov <juri@jurta.org> writes:

> But the problem needs to be fixed anyway.  So maybe we could add the
> face attribute :distant-foreground to the `lazy-highlight' face
> that could be applied only when the background color is near to the
> foreground color like a cyan foreground on a cyan background.

I've now done this in Emacs 29.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

end of thread, other threads:[~2022-02-05 22:46 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-08 18:35 bug#16969: Isearch: lazy-highlight face sometimes has foreground and background the same colour Alan Mackenzie
2014-03-08 21:55 ` Juri Linkov
2014-03-08 23:01   ` Alan Mackenzie
2014-03-09  9:37     ` Jan Djärv
2014-03-09 13:25       ` Alan Mackenzie
2014-03-09  0:45   ` Daniel Colascione
2014-03-09 21:43     ` Juri Linkov
2014-03-09 22:20       ` Drew Adams
2014-03-10  3:01     ` Stefan Monnier
2022-02-05 22:46   ` Lars Ingebrigtsen

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