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: Tom Tromey
Subject: bug#25525: 25.1.90; add color highlighting to css mode
Date: Fri, 10 Feb 2017 21:11:48 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.91 (gnu/linux)

>>>>> "Eli" == Eli Zaretskii <address@hidden> writes:

Eli> I thought about something like
Eli>   (if (> (color-distance color "black") 292485) "black" "white")
Eli> I think this is the equivalent of your test.

I tried this.  In particular with the patch applied, I did this in a
temporary (fundamental-mode) buffer:

(mapcar
 (lambda (c)
   (insert
    (propertize (car c) 'font-lock-face
                (list :background (cdr c)
                      :foreground (css--contrasty-color (cdr c))))
    " "
    (propertize (car c) 'font-lock-face
                (list :background (cdr c)
                      :foreground
                      (if (> (color-distance (cdr c) "black") 292485)
                          "black" "white")))
    "\n"))
 css--color-map)


... then I looked at all the pairs.

For the most part I think they are all ok.  Occasionally color-distance
picks a different color, sometimes a mildly worse one IMO, though at
least in one case ("grey") a mildly better one.

Anyway, I think it's good enough, and if someone trips across a
difficult case and files a bug, we can revisit it at that time.

Tom





reply via email to

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