From: Josh <josh@foxtail.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: "Chong Yidong" <cyd@gnu.org>, "Jan Djärv" <jan.h.d@swipnet.se>,
emacs-devel <emacs-devel@gnu.org>
Subject: Re: About the :distant-foreground face attribute
Date: Thu, 9 Jan 2014 09:39:43 -0800 [thread overview]
Message-ID: <CANdFEAHYZ=TtbZgS53DEgLeojsJYmVyfj-rLLEdct04WF8WMPg@mail.gmail.com> (raw)
In-Reply-To: <83zjn5cch3.fsf@gnu.org>
On Thu, Jan 9, 2014 at 9:05 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>> From: Chong Yidong <cyd@gnu.org>
>> Cc: jan.h.d@swipnet.se, emacs-devel@gnu.org
>> Date: Fri, 10 Jan 2014 00:15:00 +0800
>>
>> Eli Zaretskii <eliz@gnu.org> writes:
>>
>> >> 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.
>> >
>> > I'm not sure I see the ugliness, please elaborate.
>>
>> One face attribute should govern one aspect of how the face is
>> displayed. In some cases, it may be hard to avoid having multiple
>> attributes with overlapping effects, but the results are not pretty.
>> For example, the interactions between :family, :foundry and :font have
>> been a source of annoyance over the years. Introducing another such
>> situation should, in my view, be avoided as far as possible.
>>
>> An example of a face attribute that handles things right is the :height
>> attribute. An absolute height is given by an integer, while a relative
>> height can be specified by a float. Allowing both in a single attribute
>> is good, because absolute height and the relative height are just
>> different ways to specify height. We don't have a :height and a
>> separate :relative-height attribute.
>
> If you are arguing for a change in the syntax of :foreground such that
> it could convey the information about both the "normal" color, and the
> alternate color to be used when the background is too similar to that
> "normal" color, then I agree it will probably be a nicer and cleaner
> feature. But that means :foreground will no longer be a simple
> string, but some more complex data structure, e.g. a list.
>
>> If I cannot convince anyone that there is a problem here, then forget
>> it.
>
> Don't give up just yet ;-)
>
> The solution should be able to cope with the need to dynamically
> decide which color is used as a foreground, based on the current
> background. It also needs to support the possibility that a face will
> want to force use of a specific fixed foreground color, regardless of
> the background. (Jan, did I miss some additional requirements?) If
> you can propose a cleaner solution that satisfies these requirements,
> please do, and let's discuss that.
Instead of explicitly specifying alternative foreground colors,
whether by introducing a new face attribute or extending the
current :foreground attribute, perhaps we could introduce a new
`minimum-color-distance' user preference that would be used
something like this:
(defun choose-foreground-color (fg bg minimum-color-distance)
(if (or (> (color-distance fg bg) minimum-color-distance)
;; ^^^ foreground and background are sufficiently different
(= fg bg))
;; ^^^ special case for text invisibility via fg==bg
fg ;; preferred foreground color is ok; use it
;; otherwise, compute new foreground color -- not necessarily
;; via logxor but somehow guaranteed to be distant from bg
(cl-mapcar 'logxor fg bg)))
Though such computed colors are likely to be ugly, clash with color
themes, etc. this approach is less invasive than the others being
discussed and I think it accomplishes the primary goal of ensuring
that bad combinations of foreground and background colors cannot
render text illegible.
Josh
next prev parent reply other threads:[~2014-01-09 17:39 UTC|newest]
Thread overview: 135+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-07 12:55 About the :distant-foreground face attribute Chong Yidong
2014-01-07 15:00 ` Jan Djärv
2014-01-07 17:28 ` Drew Adams
2014-01-07 18:01 ` Eli Zaretskii
2014-01-07 18:09 ` Joel Mccracken
[not found] ` <<8361pvsmbk.fsf@gnu.org>
2014-01-07 18:44 ` Drew Adams
2014-01-07 19:01 ` Eli Zaretskii
[not found] ` <<83zjn7r4z3.fsf@gnu.org>
2014-01-07 19:06 ` Drew Adams
2014-01-07 19:15 ` Eli Zaretskii
2014-01-07 21:57 ` Chong Yidong
2014-01-08 3:45 ` Eli Zaretskii
2014-01-08 5:24 ` Chong Yidong
2014-01-08 9:35 ` Jan Djärv
2014-01-08 9:52 ` Chong Yidong
2014-01-08 10:10 ` Jan Djärv
2014-01-08 14:49 ` Chong Yidong
2014-01-08 16:37 ` Jan Djärv
2014-01-08 17:08 ` Drew Adams
2014-01-08 16:57 ` Drew Adams
2014-01-08 14:05 ` Stefan Monnier
2014-01-08 17:43 ` Eli Zaretskii
2014-01-09 16:15 ` Chong Yidong
2014-01-09 17:02 ` Stefan Monnier
2014-01-09 17:07 ` Drew Adams
2014-01-09 17:46 ` Eli Zaretskii
2014-01-09 18:21 ` Chong Yidong
2014-01-09 22:25 ` Drew Adams
2014-01-09 22:48 ` David Engster
2014-01-12 11:14 ` David Engster
2014-01-12 11:40 ` Jan Djärv
2014-01-12 12:21 ` David Engster
2014-01-12 12:56 ` Jan Djärv
2014-01-12 13:07 ` David Engster
2014-01-12 13:17 ` Jan Djärv
2014-01-12 20:14 ` Chong Yidong
2014-01-12 21:20 ` Drew Adams
2014-01-12 22:07 ` Jan Djärv
2014-01-13 0:57 ` Drew Adams
2014-01-12 22:59 ` Stefan Monnier
2014-01-13 4:14 ` chad
2014-01-09 17:05 ` Eli Zaretskii
2014-01-09 17:22 ` David Engster
2014-01-09 17:27 ` Lars Magne Ingebrigtsen
2014-01-09 17:50 ` Jan D.
2014-01-09 20:58 ` Darren Hoo
2014-01-09 21:17 ` David Engster
2014-01-09 22:29 ` Darren Hoo
2014-01-09 22:25 ` Drew Adams
2014-01-09 22:24 ` Drew Adams
2014-01-09 17:39 ` Josh [this message]
2014-01-09 17:57 ` Eli Zaretskii
2014-01-09 17:49 ` Jan D.
2014-01-13 13:13 ` [PATCH] " Daniel Colascione
2014-01-13 16:27 ` Jan Djärv
2014-01-13 16:33 ` Jan Djärv
2014-01-13 18:41 ` Daniel Colascione
2014-01-13 21:29 ` Jan Djärv
2014-01-13 21:36 ` Daniel Colascione
2014-01-13 23:01 ` Drew Adams
2014-01-13 23:11 ` Daniel Colascione
2014-01-14 1:32 ` Drew Adams
2014-01-14 1:45 ` Stefan Monnier
2014-01-14 19:32 ` Drew Adams
2014-01-14 2:34 ` Daniel Colascione
2014-01-14 19:32 ` Drew Adams
2014-01-14 22:38 ` Daniel Colascione
2014-01-15 0:31 ` Drew Adams
2014-01-15 0:54 ` Daniel Colascione
2014-01-15 3:07 ` Drew Adams
2014-01-15 3:52 ` Daniel Colascione
2014-01-15 4:59 ` Drew Adams
2014-01-15 5:12 ` Daniel Colascione
2014-01-15 5:39 ` Drew Adams
2014-01-15 14:38 ` Stefan Monnier
2014-01-15 4:50 ` Yuri Khan
2014-01-15 7:50 ` Jan D.
2014-01-15 7:52 ` Daniel Colascione
2014-01-15 8:17 ` Jan D.
2014-01-15 17:23 ` Drew Adams
2014-01-13 23:57 ` Stefan Monnier
2014-01-14 0:07 ` Daniel Colascione
2014-01-14 1:45 ` Stefan Monnier
2014-01-14 2:41 ` Daniel Colascione
2014-01-14 8:47 ` Chong Yidong
2014-01-14 9:42 ` Jan D.
2014-01-14 19:32 ` Drew Adams
2014-01-14 7:47 ` Jan D.
2014-01-14 8:18 ` Daniel Colascione
2014-01-14 9:34 ` Jan D.
2014-01-14 10:44 ` Daniel Colascione
2014-01-14 11:44 ` Jan D.
2014-01-14 17:56 ` Stefan Monnier
2014-01-14 18:06 ` Jan Djärv
2014-01-14 18:31 ` Daniel Colascione
2014-01-14 18:51 ` John Yates
2014-01-14 22:19 ` Stefan Monnier
2014-01-14 18:47 ` Daniel Colascione
2014-01-14 20:01 ` Jan Djärv
2014-01-14 20:06 ` Daniel Colascione
2014-01-14 22:05 ` [PATCH] " Jan Djärv
2014-01-14 22:14 ` Daniel Colascione
2014-01-15 6:33 ` Jan Djärv
2014-01-15 8:05 ` Daniel Colascione
2014-01-15 9:25 ` Jan D.
2014-01-15 14:43 ` Stefan Monnier
2014-01-14 20:39 ` [PATCH] " Daniel Colascione
2014-01-14 21:58 ` [PATCH] " Jan Djärv
2014-01-14 22:06 ` Drew Adams
2014-01-15 3:52 ` Eli Zaretskii
2014-01-15 4:22 ` Stefan Monnier
2014-01-15 4:25 ` Daniel Colascione
2014-01-15 6:39 ` Jan Djärv
2014-01-15 15:39 ` Eli Zaretskii
2014-01-15 14:41 ` Stefan Monnier
2014-01-15 15:38 ` Eli Zaretskii
2014-01-15 16:17 ` Stefan Monnier
2014-01-15 16:53 ` Eli Zaretskii
2014-01-15 17:33 ` Stefan Monnier
2014-01-15 17:51 ` Eli Zaretskii
2014-01-15 18:43 ` Stefan Monnier
2014-01-15 19:06 ` Eli Zaretskii
2014-01-15 20:05 ` Josh
2014-01-15 20:40 ` Eli Zaretskii
2014-01-15 21:03 ` Daniel Colascione
2014-01-15 21:12 ` Eli Zaretskii
2014-01-15 21:15 ` Daniel Colascione
2014-01-15 21:31 ` John Yates
2014-01-15 22:11 ` Drew Adams
2014-01-15 23:58 ` Stefan Monnier
2014-01-07 22:50 ` Jan Djärv
2014-01-08 3:13 ` Darren Hoo
[not found] <<87bnzo9cja.fsf@gnu.org>
[not found] ` <<59B7E7FC-48D0-4737-B1BB-FFAC5BA9E07A@swipnet.se>
[not found] ` <<874n5f3162.fsf@gnu.org>
[not found] ` <<83fvozf86g.fsf@gnu.org>
[not found] ` <<87r48javwe.fsf@gnu.org>
[not found] ` <<83bnzmfjxe.fsf@gnu.org>
[not found] ` <<87bnzlyvwb.fsf@gnu.org>
[not found] ` <<jwvppo1dr9r.fsf-monnier+emacs@gnu.org>
[not found] ` <<b53f01f5-1974-417a-b95b-a7e1b6906467@default>
[not found] ` <<83wqi9cakl.fsf@gnu.org>
2014-01-09 21:12 ` Drew Adams
2014-01-09 21:22 ` Eli Zaretskii
[not found] ` <<52D3E689.6050902@dancol.org>
[not found] ` <<8E16225F-53EF-498A-AB35-66EB9B33B859@swipnet.se>
[not found] ` <<52D43360.6050605@dancol.org>
[not found] ` <<9BD01B88-AF13-44DD-8DBE-4598BAC136DD@swipnet.se>
[not found] ` <<52D45C73.6090906@dancol.org>
[not found] ` <<52D4EBA9.8050802@swipnet.se>
[not found] ` <<52D4F2C2.8080800@dancol.org>
[not found] ` <<52D504A7.80104@swipnet.se>
[not found] ` <<52D514FF.7010404@dancol.org>
[not found] ` <<52D52312.6070106@swipnet.se>
[not found] ` <<52D58632.3010106@dancol.org>
[not found] ` <<381DEBDC-71D8-4FAC-BA55-897FEC73A2FC@swipnet.se>
[not found] ` <<52D5A072.5010508@dancol.org>
[not found] ` <<064CFFB5-6E50-40D5-B2CB-2BECC656D93F@swipnet.se>
[not found] ` <<174db5f5-db14-4484-a2f9-9478d2f5fea1@default>
[not found] ` <<83y52h52cd.fsf@gnu.org>
2014-01-15 3:56 ` [PATCH] " Drew Adams
[not found] <<35efc77e-e132-4700-ae0f-d95079293ff5@default>
[not found] ` <<83fvowdf4j.fsf@gnu.org>
2014-01-09 22:27 ` Drew Adams
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='CANdFEAHYZ=TtbZgS53DEgLeojsJYmVyfj-rLLEdct04WF8WMPg@mail.gmail.com' \
--to=josh@foxtail.org \
--cc=cyd@gnu.org \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=jan.h.d@swipnet.se \
/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).