From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.help Subject: RE: Fontify: coloring rgb hex code by its value Date: Fri, 25 Apr 2008 08:35:51 -0700 Message-ID: <003a01c8a6ea$0b02a560$0200a8c0@us.oracle.com> References: <06adf465-6005-4b23-8d0e-1ba9411c7089@m1g2000pre.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1209137841 12292 80.91.229.12 (25 Apr 2008 15:37:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 25 Apr 2008 15:37:21 +0000 (UTC) To: "'Xah'" , Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Apr 25 17:37:56 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 1JpPz9-0000IC-T5 for geh-help-gnu-emacs@m.gmane.org; Fri, 25 Apr 2008 17:37:16 +0200 Original-Received: from localhost ([127.0.0.1]:48199 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JpPyT-0007KH-Ea for geh-help-gnu-emacs@m.gmane.org; Fri, 25 Apr 2008 11:36:33 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JpPyC-0007JF-9S for help-gnu-emacs@gnu.org; Fri, 25 Apr 2008 11:36:16 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JpPyB-0007I0-0n for help-gnu-emacs@gnu.org; Fri, 25 Apr 2008 11:36:16 -0400 Original-Received: from [199.232.76.173] (port=54644 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JpPyA-0007Hv-PE for help-gnu-emacs@gnu.org; Fri, 25 Apr 2008 11:36:14 -0400 Original-Received: from rgminet01.oracle.com ([148.87.113.118]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JpPyA-0006JY-IJ for help-gnu-emacs@gnu.org; Fri, 25 Apr 2008 11:36:14 -0400 Original-Received: from agmgw2.us.oracle.com (agmgw2.us.oracle.com [152.68.180.213]) by rgminet01.oracle.com (Switch-3.2.4/Switch-3.1.6) with ESMTP id m3PFa9LC029904; Fri, 25 Apr 2008 09:36:09 -0600 Original-Received: from acsmt351.oracle.com (acsmt351.oracle.com [141.146.40.151]) by agmgw2.us.oracle.com (Switch-3.2.0/Switch-3.2.0) with ESMTP id m3NCRoBd020081; Fri, 25 Apr 2008 09:36:08 -0600 Original-Received: from inet-141-146-46-1.oracle.com by acsmt350.oracle.com with ESMTP id 3659804581209137751; Fri, 25 Apr 2008 08:35:51 -0700 Original-Received: from dradamslap1 (/141.144.80.109) by bhmail.oracle.com (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 25 Apr 2008 08:35:50 -0700 X-Mailer: Microsoft Office Outlook 11 Thread-Index: Acimfev2pdcWvxIpTD+3W1DJX5K5cAAau7XA In-Reply-To: <06adf465-6005-4b23-8d0e-1ba9411c7089@m1g2000pre.googlegroups.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 X-Brightmail-Tracker: AAAAAQAAAAI= X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE X-Whitelist: TRUE X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 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:53536 Archived-At: > 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. I believe this is done in the code for `list-colors-display'. That could be one place to start. I do the same thing in some of my code, for example this: (defun icicle-make-color-candidate (color-name &optional hex-rgb) (let ((rgb-string (or hex-rgb (hexrgb-color-name-to-hex color-name)))) (put-text-property 0 (length rgb-string) 'face (cons 'background-color rgb-string) rgb-string) (list (list color-name rgb-string)))) That is in icicles-cmd.el: http://www.emacswiki.org/cgi-bin/wiki/icicles-cmd.el It uses code in hexrgb.el: http://www.emacswiki.org/cgi-bin/wiki/hexrgb.el See also command `palette' of palette.el, for similar code: http://www.emacswiki.org/cgi-bin/wiki/palette.el