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: Thu, 26 Jan 2017 18:05:08 +0200 Message-ID: <83d1f93iyz.fsf@gnu.org> References: <87mvefh8br.fsf@tromey.com> <83inp32l50.fsf@gnu.org> <87inp3gigu.fsf@tromey.com> <8737g6hfyv.fsf@tromey.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1485446813 9499 195.159.176.226 (26 Jan 2017 16:06:53 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 26 Jan 2017 16:06:53 +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 Thu Jan 26 17:06:43 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 1cWmYp-0007Y9-Cl for geb-bug-gnu-emacs@m.gmane.org; Thu, 26 Jan 2017 17:06:07 +0100 Original-Received: from localhost ([::1]:39537 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cWmYu-0002cZ-LB for geb-bug-gnu-emacs@m.gmane.org; Thu, 26 Jan 2017 11:06:12 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46432) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cWmYn-0002cQ-Sc for bug-gnu-emacs@gnu.org; Thu, 26 Jan 2017 11:06:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cWmYk-0007Rm-JO for bug-gnu-emacs@gnu.org; Thu, 26 Jan 2017 11:06:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:47530) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cWmYk-0007Rc-GT for bug-gnu-emacs@gnu.org; Thu, 26 Jan 2017 11:06:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cWmYk-0007T8-Ax for bug-gnu-emacs@gnu.org; Thu, 26 Jan 2017 11:06: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: Thu, 26 Jan 2017 16:06: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: patch Original-Received: via spool by 25525-submit@debbugs.gnu.org id=B25525.148544673728659 (code B ref 25525); Thu, 26 Jan 2017 16:06:02 +0000 Original-Received: (at 25525) by debbugs.gnu.org; 26 Jan 2017 16:05:37 +0000 Original-Received: from localhost ([127.0.0.1]:45726 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cWmYL-0007SB-0Z for submit@debbugs.gnu.org; Thu, 26 Jan 2017 11:05:37 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:55270) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cWmYJ-0007Ry-Rk for 25525@debbugs.gnu.org; Thu, 26 Jan 2017 11:05:36 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cWmYA-0007Kv-0G for 25525@debbugs.gnu.org; Thu, 26 Jan 2017 11:05:30 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:49670) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cWmY9-0007Kr-Tu; Thu, 26 Jan 2017 11:05:25 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3595 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1cWmY9-00055V-01; Thu, 26 Jan 2017 11:05:25 -0500 In-reply-to: <8737g6hfyv.fsf@tromey.com> (message from Tom Tromey on Wed, 25 Jan 2017 16:34:00 -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:128558 Archived-At: > From: Tom Tromey > Cc: Eli Zaretskii , 25525@debbugs.gnu.org > Date: Wed, 25 Jan 2017 16:34:00 -0700 > > >>>>> "Tom" == Tom Tromey writes: > > Tom> It seemed simpler to always set the :foreground, but I can experiment > Tom> with :distant-foreground instead. > > I gave this a try. I think the code in this patch works better than > :distant-foreground. > > One case where it is better is the CSS color "purple", aka #800080. > > In my theme the foreground color is black. My patch picks white as the > foreground, but the Emacs chooses not to use a distant-foreground, but > rather keep a black foreground. > > You can compare these two cases by evalling: > > (progn > (insert (propertize > "hello\n" > 'font-lock-face '(:background "#800080" :foreground "black" > :distant-foreground "white"))) > (insert (propertize > "hello\n" > 'font-lock-face '(:background "#800080" :foreground "white")))) > > I find the latter much more readable. If all you need is to choose either black or white as the foreground color, then :distant-foreground is indeed not for you. Still, I'd suggest to use color-distance rather than to invent a new metric. Or maybe just always use the color that is complementary to the background color, as black and white seem arbitrary to me. Thanks.