bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#25525: 25.1.90; add color highlighting to css mode


From: Eli Zaretskii
Subject: bug#25525: 25.1.90; add color highlighting to css mode
Date: Thu, 26 Jan 2017 18:05:08 +0200

> From: Tom Tromey <address@hidden>
> Cc: Eli Zaretskii <address@hidden>,  address@hidden
> Date: Wed, 25 Jan 2017 16:34:00 -0700
> 
> >>>>> "Tom" == Tom Tromey <address@hidden> writes:
> 
> Tom> It seemed simpler to always set the :foreground, but I can experiment
> Tom> with :distant-foreground instead.
> 
> I gave this a try.  I think the code in this patch works better than
> :distant-foreground.
> 
> One case where it is better is the CSS color "purple", aka #800080.
> 
> In my theme the foreground color is black.  My patch picks white as the
> foreground, but the Emacs chooses not to use a distant-foreground, but
> rather keep a black foreground.
> 
> You can compare these two cases by evalling:
> 
> (progn
>   (insert (propertize
>          "hello\n"
>          'font-lock-face '(:background "#800080" :foreground "black"
>                                        :distant-foreground "white")))
>   (insert (propertize
>          "hello\n"
>          'font-lock-face '(:background "#800080" :foreground "white"))))
> 
> I find the latter much more readable.

If all you need is to choose either black or white as the foreground
color, then :distant-foreground is indeed not for you.  Still, I'd
suggest to use color-distance rather than to invent a new metric.  Or
maybe just always use the color that is complementary to the
background color, as black and white seem arbitrary to me.

Thanks.





reply via email to

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