Subject: Re: bug#16969: Isearch: lazy-highlight face sometimes has foreground and background the same colour.

From: Juri Linkov <[email-masked]>
Date: Sun, 09 Mar 2014 23:43:52 +0200

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