From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chris McMahan Newsgroups: gmane.emacs.help Subject: Re: Fontify: coloring rgb hex code by its value Date: Sat, 26 Apr 2008 14:09:38 -0400 Organization: PANIX Public Access Internet and UNIX, NYC Message-ID: References: <06adf465-6005-4b23-8d0e-1ba9411c7089@m1g2000pre.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1209235251 16985 80.91.229.12 (26 Apr 2008 18:40:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 26 Apr 2008 18:40:51 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Apr 26 20:41:23 2008 connect(): Connection refused Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JppKr-0005kF-7f for geh-help-gnu-emacs@m.gmane.org; Sat, 26 Apr 2008 20:41:21 +0200 Original-Received: from localhost ([127.0.0.1]:46446 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JppKA-0005dh-T7 for geh-help-gnu-emacs@m.gmane.org; Sat, 26 Apr 2008 14:40:38 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!198.186.194.247.MISMATCH!news-out.readnews.com!transit3.readnews.com!panix!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 48 Original-NNTP-Posting-Host: panix5.panix.com Original-X-Trace: reader2.panix.com 1209233373 24302 166.84.1.5 (26 Apr 2008 18:09:33 GMT) Original-X-Complaints-To: abuse@panix.com Original-NNTP-Posting-Date: Sat, 26 Apr 2008 18:09:33 +0000 (UTC) User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (windows-nt) Cancel-Lock: sha1:1NT6jfgXw+mqpNN8ShIjg/7MInE= Original-Xref: shelby.stanford.edu gnu.emacs.help:158197 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:53563 Archived-At: Here's what I have in my .emacs (I culled of the net somewhere a while back). I'm sure you can adapt this to whatever mode you want. - Chris ;;;====================================================================== ;;; automatically color hex color strings (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 () (font-lock-add-keywords nil hexcolor-keywords)) (add-hook 'emacs-lisp-mode-hook 'hexcolor-add-to-font-lock) (add-hook 'nxml-mode-hook 'hexcolor-add-to-font-lock) Xah writes: > i seems to recall that there's a module that will fontify a hex color > code by its value. > That is, if i have this line in my .css file: > > pre.php {border-color:#2e8b57} > > then the “#2e8b57” is colored using that value. > > anyone know what's the name of this module or where can i get it? > > A short code showing can this can be written will also be appreciated. > > Thanks. > > Xah > xah@xahlee.org > ∑ http://xahlee.org/ > > ☄ -- (. .) =ooO=(_)=Ooo===================================== Chris McMahan | first_initiallastname@one.dot.net =================================================