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

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

bug#30295: CSS mode colour highlighting makes text hard to read


From: Juri Linkov
Subject: bug#30295: CSS mode colour highlighting makes text hard to read
Date: Thu, 01 Feb 2018 23:17:47 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)

> In CSS mode, the value "green" or "#0f0" or "rgba(0,255,0,0.5)" is
> displayed with a white foreground and a 100%-green background, which
> is difficult to see.
>
> A white foreground is chosen on even lighter colours, for example,
> "#5e5" and "#87e087".
>
> See functions css--contrasty-color in textmodes/css-mode.el and
> color-distance in src/xfaces.c, and
> <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25525>, and
> <https://www.compuphase.com/cmetric.htm>.
>
> If the color-distance is to be used, the appropriate formula is:
>
> (if (> (color-distance name "black") (color-distance name "white"))
> "black" "white")
>
> That formula still maps "green" to "white", but it does at least map
> lighter colours such as "#38e038" to "black".
>
> For what it's worth, in my inexpert opinion it makes more sense to
> compare the luma against that of mid-grey as Tom originally proposed.

Indeed, luma is more suitable than mid-grey, customizing
‘list-colors-sort’ to “luminance” shows that distinguishable colors with
the black foreground start closer to the beginning of the color list.

Or we could use both luma and distance like in ‘shr-color-visible’
with two customizable options:
‘shr-color-visible-luminance-min’ and
‘shr-color-visible-distance-min’.





reply via email to

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