all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#30295: CSS mode colour highlighting makes text hard to read
@ 2018-01-30 16:55 Richard Copley
  2018-02-01 21:17 ` Juri Linkov
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Copley @ 2018-01-30 16:55 UTC (permalink / raw)
  To: 30295

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.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-06-15 20:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-30 16:55 bug#30295: CSS mode colour highlighting makes text hard to read Richard Copley
2018-02-01 21:17 ` Juri Linkov
2018-02-01 23:03   ` Richard Copley
2020-06-15 20:12     ` Simen Heggestøyl

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.