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: Eli Zaretskii
Subject: bug#25525: 25.1.90; add color highlighting to css mode
Date: Wed, 25 Jan 2017 17:51:23 +0200

> From: Tom Tromey <tom@tromey.com>
> Date: Wed, 25 Jan 2017 01:06:48 -0700
> 
> This patch adds color highlighting to CSS mode.
> 
> In particular, this provides a new jit-lock function that recognizes the
> various forms of CSS color syntax, including some css-color-4 additions.
> 
> When such a color is seen, the background color of the text is set to
> the color itself.  In order to remain readable, the foreground is set to
> a contrasting color, and a box is put around the text (this helps
> distinguish colors that are close to the buffer's background color).
> 
> While doing this I noticed that css-mode was missing a few named colors
> specified by CSS, in particular:
> 
>     ("darkgrey" "darkslategrey" "dimgrey" "grey" "lightgrey"
>     "lightslategrey" "slategrey")
> 
> This patch fixes this problem as well.

Thanks.

I wonder whether it would make sense to reuse some existing data and
code here?

For example, tty-colors.el already has a (longer) list of colors with
suitable RGB values, so perhaps we should simply add the few missing
ones to that list, and then use that for CSS?

As another example, tty-colors.el also includes code for parsing and
converting color values (although perhaps not all of the formats you
support in your code).

As yet another example of existing functionality that you could
perhaps reuse, there's the :distant-foreground attribute of a face
that might help you with the issue of color contrast.

If you already considered all those and decided not to use them, could
you tell why?





reply via email to

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