Add a predicate, color-dark-p, for deciding whether a colour is more
readable with black or white as contrast. It has experimentally been
shown to be more accurate and robust than the various methods
currently employed.
The new predicate compares the relative luminance of the colour to an
empirically determined cut-off value, and it seems to get it right in
almost all cases, with no value leading to outright bad results.
* lisp/faces.el (readable-foreground-color): Use color-dark-p.
(color-dark-p): New function.
* lisp/facemenu.el (list-colors-print): Use readable-foreground-color,
improving readability of list-colors-display.
* lisp/textmodes/css-mode.el (css--contrasty-color): Remove.
(css--fontify-region): Use readable-foreground-color.