From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#25525: 25.1.90; add color highlighting to css mode Date: Wed, 25 Jan 2017 17:51:23 +0200 Message-ID: <83inp32l50.fsf@gnu.org> References: <87mvefh8br.fsf@tromey.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1485359632 16930 195.159.176.226 (25 Jan 2017 15:53:52 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 25 Jan 2017 15:53:52 +0000 (UTC) Cc: 25525@debbugs.gnu.org To: Tom Tromey Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jan 25 16:53:44 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cWPsg-0001JL-Ec for geb-bug-gnu-emacs@m.gmane.org; Wed, 25 Jan 2017 16:53:06 +0100 Original-Received: from localhost ([::1]:60784 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cWPsl-0007VI-P0 for geb-bug-gnu-emacs@m.gmane.org; Wed, 25 Jan 2017 10:53:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36143) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cWPrj-00070d-4h for bug-gnu-emacs@gnu.org; Wed, 25 Jan 2017 10:52:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cWPrf-0003Wi-6J for bug-gnu-emacs@gnu.org; Wed, 25 Jan 2017 10:52:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:44755) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cWPrf-0003Wa-2c for bug-gnu-emacs@gnu.org; Wed, 25 Jan 2017 10:52:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cWPre-0000xX-Pi for bug-gnu-emacs@gnu.org; Wed, 25 Jan 2017 10:52:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 25 Jan 2017 15:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25525 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 25525-submit@debbugs.gnu.org id=B25525.14853595123664 (code B ref 25525); Wed, 25 Jan 2017 15:52:02 +0000 Original-Received: (at 25525) by debbugs.gnu.org; 25 Jan 2017 15:51:52 +0000 Original-Received: from localhost ([127.0.0.1]:42953 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cWPrU-0000x1-9U for submit@debbugs.gnu.org; Wed, 25 Jan 2017 10:51:52 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:45038) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cWPrS-0000wp-Ud for 25525@debbugs.gnu.org; Wed, 25 Jan 2017 10:51:51 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cWPrJ-0003TO-P6 for 25525@debbugs.gnu.org; Wed, 25 Jan 2017 10:51:45 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:33829) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cWPrJ-0003TK-ML; Wed, 25 Jan 2017 10:51:41 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2863 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1cWPrI-0006JQ-Nb; Wed, 25 Jan 2017 10:51:41 -0500 In-reply-to: <87mvefh8br.fsf@tromey.com> (message from Tom Tromey on Wed, 25 Jan 2017 01:06:48 -0700) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:128450 Archived-At: > From: Tom Tromey > 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?