emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: About the :distant-foreground face attribute


From: Chong Yidong
Subject: Re: About the :distant-foreground face attribute
Date: Wed, 08 Jan 2014 13:24:17 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

>> The feature does not fit well with the design of the rest of the
>> face-handling code.  We already have a mechanism for checking to see
>> when to use a particular face: the DISPLAY element in a face spec.  The
>> :distant-foreground face attribute, by its very existence, is redundant
>> with what the DISPLAY element was meant to do.  This adds extra
>> complexity to the design, for no good reason.
>
> I don't understand this criticism.  How is this attribute different
> from min-colors?

The min-colors feature doesn't involve adding an extra face attribute.
The analogy would be if there was a :low-color-foreground face attribute
which would override :foreground on low-color displays.  That would be
ugly, as I hope you agree.

OK, after poking around a bit I understand the problem better.  You want
to be free to set face background colors without worrying about making
text illegible (which can be difficult to figure out ahead of time,
because of face inheritance etc).  So here's a proposal:

Change the feature so it applies to all faces, but in a configurable
way.  Introduce a new Lisp variable, `face-minimum-contrast', which
specifies the minimum allowed contrast between the background and
foreground of any face (or nil, which means to disable the feature).  If
the contrast of a face is lower than specified, the foreground color is
adjusted (say, by changing its V component) to conform to the minimum
contrast.

This would avoid having to introduce a :distant-foreground attribute for
all faces, only to use that attribute for just one face (`region') and
for one special purpose (to cope with the GTK selection color).  It
would handle the generic class of problems involving text becoming
illegible, such as due to bad themes.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]