* bug#2773: feature request: option for css mode to highlight #rrggbb text
@ 2009-03-25 0:35 xah lee
2011-07-22 15:30 ` Julien Danjou
0 siblings, 1 reply; 2+ messages in thread
From: xah lee @ 2009-03-25 0:35 UTC (permalink / raw)
To: bug-gnu-emacs
this is a feature request, for a option for css mode to highlight
#rrggbb text.
Explanation:
in CSS, there are lots of RGB values, e.g.
pre.c {border-color:#454545}
pre.java {border-color:#a020f0}
pre.haskell {border-color:#00b2ee}
pre.ocaml {border-color:#6b8e23}
it is very convenient if the rgb code can be colored by its value, so
that users can visually see what color they represent.
the css-mode that comes with emacs 22 doesn't seems to support this
feature. (doesn't seem to have customize-group support)
Here's a implementation that i've been using for a few months.
;; by Nikolaj Schumacher. http://www.emacswiki.org/emacs/HexColour
(defvar hexcolor-keywords
'(("#[abcdef[:digit:]]\\{6\\}"
(0 (put-text-property
(match-beginning 0)
(match-end 0)
'face (list :background
(match-string-no-properties 0)))))))
(defun hexcolor-add-to-font-lock ()
(interactive)
(font-lock-add-keywords nil hexcolor-keywords))
(add-hook 'css-mode-hook 'hexcolor-add-to-font-lock)
Note: CSS spec also allows this short form #RGB, where each of the
rgb is a single char. e.g. #f3c is the same as #ff33cc. The above
code need a bit tweak for this case.
In GNU Emacs 22.2.1 (powerpc-apple-darwin8.11.0, Carbon Version 1.6.0)
of 2008-04-05 on g5.tokyo.stp.isas.jaxa.jp
Thanks.
Xah
∑ http://xahlee.org/
☄
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug#2773: feature request: option for css mode to highlight #rrggbb text
2009-03-25 0:35 bug#2773: feature request: option for css mode to highlight #rrggbb text xah lee
@ 2011-07-22 15:30 ` Julien Danjou
0 siblings, 0 replies; 2+ messages in thread
From: Julien Danjou @ 2011-07-22 15:30 UTC (permalink / raw)
To: xah lee; +Cc: 2773
[-- Attachment #1: Type: text/plain, Size: 304 bytes --]
On Wed, Mar 25 2009, xah lee wrote:
rainbow-mode is included into ELPA and does exactly that for css-mode,
but also for X colors or LaTeX.
Its inclusion has been discussed and refused into Emacs, therefore, I
think this bug should be closed.
--
Julien Danjou
❱ http://julien.danjou.info
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-07-22 15:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-25 0:35 bug#2773: feature request: option for css mode to highlight #rrggbb text xah lee
2011-07-22 15:30 ` Julien Danjou
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.