[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#30295: CSS mode colour highlighting makes text hard to read
From: |
Richard Copley |
Subject: |
bug#30295: CSS mode colour highlighting makes text hard to read |
Date: |
Tue, 30 Jan 2018 16:55:14 +0000 |
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.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug#30295: CSS mode colour highlighting makes text hard to read,
Richard Copley <=