From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.bugs Subject: bug#41544: 26.3; Possible incorrect results from color-distance Date: Sat, 6 Jun 2020 18:54:41 +0200 Message-ID: References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@acm.org> <87r1v2aat3.fsf@tromey.com> <9902865C-01B4-4E50-A433-DBC8B8311234@acm.org> <83tuzueogo.fsf@gnu.org> <6272275C-560C-4437-90F1-2A8294D27019@acm.org> <83o8q2elja.fsf@gnu.org> <83mu5mel4o.fsf@gnu.org> <77F1DDD3-A69F-40ED-902D-74986D5E6596@acm.org> <83y2p5cumz.fsf@gnu.org> <83blm0cjlz.fsf@gnu.org> <83367ccf8w.fsf@gnu.org> <624D7FB8-A836-4A7E-8895-47E867214504@acm.org> <83o8pyc4bq.fsf@gnu.org> <55D73CA5-1EFB-4B0A-8F8B-FDA1D39F51BF@acm.org> <835zc5bsut.fsf@gnu.org> <3BBCFDD4-C14D-4628-91CB-2A0456A96FC7@acm.org> <838sh0abzz.fsf@gnu.org> <83r1us8kw6.fsf@gnu.org> <020DE875-14A8-457A-9AE4-AA0925DB8997@acm.org> <83img48ffx.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_DB782CBA-D227-410A-B6EF-143B5FD5022B" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="38553"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 41544@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jun 06 19:56:45 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jhd3j-0009y9-Pp for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 06 Jun 2020 19:56:45 +0200 Original-Received: from localhost ([::1]:59300 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jhd3i-0006aA-Rt for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 06 Jun 2020 13:56:42 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52934) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jhd2h-0004xp-Qc for bug-gnu-emacs@gnu.org; Sat, 06 Jun 2020 13:55:40 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40854) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jhd2h-0003sN-GO for bug-gnu-emacs@gnu.org; Sat, 06 Jun 2020 13:55:39 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jhc62-0004zw-7S for bug-gnu-emacs@gnu.org; Sat, 06 Jun 2020 12:55:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 06 Jun 2020 16:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41544 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 41544-submit@debbugs.gnu.org id=B41544.159146248919190 (code B ref 41544); Sat, 06 Jun 2020 16:55:02 +0000 Original-Received: (at 41544) by debbugs.gnu.org; 6 Jun 2020 16:54:49 +0000 Original-Received: from localhost ([127.0.0.1]:52351 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jhc5p-0004zS-8X for submit@debbugs.gnu.org; Sat, 06 Jun 2020 12:54:49 -0400 Original-Received: from mail85c50.megamailservers.eu ([91.136.10.95]:37822 helo=mail18c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jhc5m-0004zI-OQ for 41544@debbugs.gnu.org; Sat, 06 Jun 2020 12:54:47 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1591462484; bh=Dds8aXuevS4wq1D2mmOF90T3VLD0LEqC1wVjfMJ6xx0=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=mQ6T//fqGfn1Gx4CHCQZK9xF9PowGSM5pCe0+Y/fASvb9LJG4E6X7KQbm1UmTxfw3 6nokwdCFVU++kmLQESdjqNKbIgGIPAtvJ4qxJIDdTYOkC4ucQz1YSucqOX9oQszlOy OocKZ4MPA+kY6V3x7XGL+WVFHn9+OAhmvNodkoEo= Feedback-ID: mattiase@acm.or Original-Received: from stanniol.lan (c-4e4ae655.032-75-73746f71.bbcust.telenor.se [85.230.74.78]) (authenticated bits=0) by mail18c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 056GsgpG019201; Sat, 6 Jun 2020 16:54:44 +0000 In-Reply-To: <83img48ffx.fsf@gnu.org> X-Mailer: Apple Mail (2.3445.104.14) X-CTCH-RefID: str=0001.0A782F26.5EDBC9F6.003F:SCFSTAT68638221, ss=1, re=-4.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: -4.000 X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=K8Zc4BeI c=1 sm=1 tr=0 a=klNLuyVZdLUgl+K5Uafb2A==:117 a=klNLuyVZdLUgl+K5Uafb2A==:17 a=M51BFTxLslgA:10 a=mDV3o1hIAAAA:8 a=jVEikXp7SrS73UKdutoA:9 a=CjuIK1q_8ugA:10 a=LUiTdrM7ar1z_bhPKtoA:9 a=B2y7HmGcmWMA:10 a=_FVE-zBwftR9WsbkzFJk:22 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:181623 Archived-At: --Apple-Mail=_DB782CBA-D227-410A-B6EF-143B5FD5022B Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii 6 juni 2020 kl. 15.57 skrev Eli Zaretskii : >> can you come up with a concrete and realistic example of what you = think will break? >=20 > None at this time. That's high praise! > I think a Lisp program that interprets the documentation too > literally is making a mistake I must remember that, a most useful answer! > , but I'm not opposed to make that > clearer in the docs. No, I really don't think we should document the bug. Since we are making little progress, let's leave color-name-to-rgb = unchanged for the moment. We can both change our minds later. It's not = strictly required for the introduction and use of color-dark-p; patch = updated. --Apple-Mail=_DB782CBA-D227-410A-B6EF-143B5FD5022B Content-Disposition: attachment; filename=0001-Use-a-single-light-dark-colour-predicate.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Use-a-single-light-dark-colour-predicate.patch" Content-Transfer-Encoding: quoted-printable =46rom=20f7693e7a2e6cc65ad40d42c9854539ed85466bae=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20= =0ADate:=20Sun,=2031=20May=202020=2021:12:46=20+0200=0A= Subject:=20[PATCH]=20Use=20a=20single=20light/dark=20colour=20predicate=0A= =0AAdd=20a=20single=20predicate,=20color-dark-p,=20for=20deciding=20= whether=20a=20colour=0Ais=20more=20readable=20against=20black=20or=20= white.=20=20Previously=20this=20was=20done=20in=0Adifferent=20ways=20in=20= several=20places,=20and=20with=20worse=20results.=20=20(Bug#41544)=0A=0A= *=20lisp/facemenu.el=20(list-colors-print):=20Use=20= readable-foreground-color.=0A(color-dark-p):=20New=20function.=0A*=20= lisp/term/pc-win.el:=20Update=20comment.=0A*=20lisp/term/rxvt.el=20= (rxvt-set-background-mode):=0A*=20lisp/term/w32console.el=20= (terminal-init-w32console):=0A*=20lisp/term/xterm.el=20= (xterm-maybe-set-dark-background-mode):=0A*=20lisp/faces.el=20= (readable-foreground-color):=0A*=20lisp/frame.el=20= (frame-set-background-mode):=20Use=20color-dark-p.=0A*=20= lisp/textmodes/css-mode.el=20(css--contrasty-color):=20Remove.=0A= (css--fontify-region):=20Use=20color-dark-p.=0A---=0A=20lisp/facemenu.el=20= =20=20=20=20=20=20=20=20=20=20|=2011=20+++++------=0A=20lisp/faces.el=20=20= =20=20=20=20=20=20=20=20=20=20=20=20|=2027=20++++++++++++++++++---------=0A= =20lisp/frame.el=20=20=20=20=20=20=20=20=20=20=20=20=20=20|=2017=20= ++++++++++-------=0A=20lisp/term/pc-win.el=20=20=20=20=20=20=20=20|=20=20= 8=20+++-----=0A=20lisp/term/rxvt.el=20=20=20=20=20=20=20=20=20=20|=2012=20= +++++-------=0A=20lisp/term/w32console.el=20=20=20=20|=20=206=20+++---=0A= =20lisp/term/xterm.el=20=20=20=20=20=20=20=20=20|=20=205=20++---=0A=20= lisp/textmodes/css-mode.el=20|=2014=20++------------=0A=208=20files=20= changed,=2048=20insertions(+),=2052=20deletions(-)=0A=0Adiff=20--git=20= a/lisp/facemenu.el=20b/lisp/facemenu.el=0Aindex=20b10d874b21..419b76101b=20= 100644=0A---=20a/lisp/facemenu.el=0A+++=20b/lisp/facemenu.el=0A@@=20= -621,12=20+621,11=20@@=20list-colors-print=0A=20=09=09=09=09=09=09=20= (downcase=20b))))))=0A=20=09(setq=20color=20(list=20color)))=0A=20=20=20=20= =20=20=20(let*=20((opoint=20(point))=0A-=09=20=20=20=20=20(color-values=20= (color-values=20(car=20color)))=0A-=09=20=20=20=20=20(light-p=20(>=3D=20= (apply=20'max=20color-values)=0A-=09=09=09=20=20(*=20(car=20= (color-values=20"white"))=20.5))))=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20(fg=20(readable-foreground-color=20(car=20color))))=0A=20=09(insert=20= (car=20color))=0A=20=09(indent-to=2022)=0A-=09(put-text-property=20= opoint=20(point)=20'face=20`(:background=20,(car=20color)))=0A+=09= (put-text-property=20opoint=20(point)=20'face=20`(:background=20,(car=20= color)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20:foreground=20,fg))=0A=20=09(put-text-property=0A=20=09=20= (prog1=20(point)=0A=20=09=20=20=20(insert=20"=20")=0A@@=20-639,7=20= +638,7=20@@=20list-colors-print=0A=20=09(insert=20(propertize=0A=20=09=09= =20(apply=20'format=20"#%02x%02x%02x"=0A=20=09=09=09(mapcar=20(lambda=20= (c)=20(ash=20c=20-8))=0A-=09=09=09=09color-values))=0A+=09=09=09=09= (color-values=20(car=20color))))=0A=20=09=09=20'mouse-face=20'highlight=0A= =20=09=09=20'help-echo=0A=20=09=09=20(let=20((hsv=20(apply=20= 'color-rgb-to-hsv=0A@@=20-651,7=20+650,7=20@@=20list-colors-print=0A=20=09= =20=20=20opoint=20(point)=0A=20=09=20=20=20'follow-link=20t=0A=20=09=20=20= =20'mouse-face=20(list=20:background=20(car=20color)=0A-=09=09=09=20=20=20= =20=20:foreground=20(if=20light-p=20"black"=20"white"))=0A+=09=09=09=20=20= =20=20=20:foreground=20fg)=0A=20=09=20=20=20'color-name=20(car=20color)=0A= =20=09=20=20=20'action=20callback-fn)))=0A=20=20=20=20=20=20=20(insert=20= "\n"))=0Adiff=20--git=20a/lisp/faces.el=20b/lisp/faces.el=0Aindex=20= e707f6f4b6..caa72fbfff=20100644=0A---=20a/lisp/faces.el=0A+++=20= b/lisp/faces.el=0A@@=20-1786,15=20+1786,24=20@@=20= defined-colors-with-face-attributes=0A=20=0A=20(defun=20= readable-foreground-color=20(color)=0A=20=20=20"Return=20a=20readable=20= foreground=20color=20for=20background=20COLOR."=0A-=20=20(let*=20((rgb=20= =20=20(color-values=20color))=0A-=09=20(max=20=20=20(apply=20#'max=20= rgb))=0A-=09=20(black=20(car=20(color-values=20"black")))=0A-=09=20= (white=20(car=20(color-values=20"white"))))=0A-=20=20=20=20;;=20Select=20= black=20or=20white=20depending=20on=20which=20one=20is=20less=20similar=20= to=0A-=20=20=20=20;;=20the=20brightest=20component.=0A-=20=20=20=20(if=20= (>=20(abs=20(-=20max=20black))=20(abs=20(-=20max=20white)))=0A-=09= "black"=0A-=20=20=20=20=20=20"white")))=0A+=20=20(if=20(color-dark-p=20= (color-name-to-rgb=20color))=20"white"=20"black"))=0A+=0A+(defun=20= color-dark-p=20(rgb)=0A+=20=20"Whether=20RGB=20is=20more=20readable=20= against=20white=20than=20black.=0A+RGB=20is=20a=203-element=20list=20(R=20= G=20B),=20each=20component=20in=20the=20range=20[0,1]."=0A+=20=20(let*=20= ((sr=20(nth=200=20rgb))=0A+=20=20=20=20=20=20=20=20=20(sg=20(nth=201=20= rgb))=0A+=20=20=20=20=20=20=20=20=20(sb=20(nth=202=20rgb))=0A+=20=20=20=20= =20=20=20=20=20;;=20Use=20the=20power=202.2=20as=20an=20approximation=20= to=20sRGB=20gamma;=0A+=20=20=20=20=20=20=20=20=20;;=20it=20should=20be=20= good=20enough=20for=20the=20purpose=20of=20this=20function.=0A+=20=20=20=20= =20=20=20=20=20(r=20(expt=20sr=202.2))=0A+=20=20=20=20=20=20=20=20=20(g=20= (expt=20sg=202.2))=0A+=20=20=20=20=20=20=20=20=20(b=20(expt=20sb=20= 2.2)))=0A+=20=20=20=20(unless=20(<=3D=200=20(min=20r=20g=20b)=20(max=20r=20= g=20b)=201)=0A+=20=20=20=20=20=20(error=20"RGB=20components=20%S=20not=20= in=20[0,1]"=20rgb))=0A+=20=20=20=20;;=20The=20cut-off=20value=20was=20= determined=20experimentally;=20see=20bug#41544.=0A+=20=20=20=20(<=20(+=20= (*=20r=200.299)=20(*=20g=200.587)=20(*=20b=200.114))=0A+=20=20=20=20=20=20= =20(eval-when-compile=20(expt=200.6=202.2)))))=0A=20=0A=20= (declare-function=20xw-color-defined-p=20"xfns.c"=20(color=20&optional=20= frame))=0A=20=0Adiff=20--git=20a/lisp/frame.el=20b/lisp/frame.el=0Aindex=20= 6c2f774709..253528da75=20100644=0A---=20a/lisp/frame.el=0A+++=20= b/lisp/frame.el=0A@@=20-1156,6=20+1156,13=20@@=20frame-background-mode=0A= =20=0A=20(defvar=20inhibit-frame-set-background-mode=20nil)=0A=20=0A= +(defun=20frame--color-name-to-rgb=20(color=20frame)=0A+=20=20"Convert=20= the=20COLOR=20string=20to=20a=20list=20of=20normalised=20RGB=20= components.=0A+Like=20`color-name-to-rgb',=20but=20works=20even=20when=20= the=20display=20has=20not=20yet=0A+been=20initialised."=0A+=20=20(let=20= ((valmax=20(if=20(eq=20(framep-on-display=20frame)=20'ns)=2065280.0=20= 65535.0)))=0A+=20=20=20=20(mapcar=20(lambda=20(x)=20(/=20x=20valmax))=20= (color-values=20color=20frame))))=0A+=0A=20(defun=20= frame-set-background-mode=20(frame=20&optional=20keep-face-specs)=0A=20=20= =20"Set=20up=20display-dependent=20faces=20on=20FRAME.=0A=20= Display-dependent=20faces=20are=20those=20which=20have=20different=20= definitions=0A@@=20-1181,13=20+1188,9=20@@=20frame-set-background-mode=0A= =20=09=09=20=20=20non-default-bg-mode)=0A=20=09=09=20=20((not=20= (color-values=20bg-color=20frame))=0A=20=09=09=20=20=20default-bg-mode)=0A= -=09=09=20=20((>=3D=20(apply=20'+=20(color-values=20bg-color=20frame))=0A= -=09=09=20=20=20=20=20=20=20;;=20Just=20looking=20at=20the=20screen,=20= colors=20whose=0A-=09=09=20=20=20=20=20=20=20;;=20values=20add=20up=20to=20= .6=20of=20the=20white=20total=0A-=09=09=20=20=20=20=20=20=20;;=20still=20= look=20dark=20to=20me.=0A-=09=09=20=20=20=20=20=20=20(*=20(apply=20'+=20= (color-values=20"white"=20frame))=20.6))=0A-=09=09=20=20=20'light)=0A-=09= =09=20=20(t=20'dark)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20((color-dark-p=20(frame--color-name-to-rgb=20bg-color=20frame))=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20'dark)=0A+=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(t=20'light)))=0A=20=09=20= =20=20(display-type=0A=20=09=20=20=20=20(cond=20((null=20(window-system=20= frame))=0A=20=09=09=20=20=20(if=20(tty-display-color-p=20frame)=20'color=20= 'mono))=0Adiff=20--git=20a/lisp/term/pc-win.el=20b/lisp/term/pc-win.el=0A= index=2076a48a86c7..16eb660f00=20100644=0A---=20a/lisp/term/pc-win.el=0A= +++=20b/lisp/term/pc-win.el=0A@@=20-54,11=20+54,9=20@@=0A=20;;=20= DJGPP-compiled=20Emacs=20on=20the=20same=20PC.=20=20The=20names=20of=20X=20= colors=20used=20to=0A=20;;=20define=20the=20pixel=20values=20are=20shown=20= as=20comments=20to=20each=20color=20below.=0A=20;;;=0A-;;=20If=20you=20= want=20to=20change=20the=20RGB=20values,=20keep=20in=20mind=20that=20= various=20pieces=0A-;;=20of=20Emacs=20think=20that=20a=20color=20whose=20= RGB=20values=20add=20up=20to=20less=20than=200.6=20of=0A-;;=20the=20= values=20for=20WHITE=20(i.e.=20less=20than=20117963)=20are=20``dark'',=20= otherwise=20the=0A-;;=20color=20is=20``light'';=20see=20= `frame-set-background-mode'=20in=20lisp/faces.el=20for=0A-;;=20an=20= example.=0A+;;=20If=20you=20want=20to=20change=20the=20RGB=20values,=20= consider=20the=20heuristics=20in=0A+;;=20`color-dark-p'=20which=20is=20= used=20to=20select=20a=20suitably=20contrasting=0A+;;=20foreground=20or=20= background=20colour.=0A=20(defvar=20msdos-color-values=0A=20=20=20= '(("black"=20=20=20=20=20=20=20=20=20=200=20=20=20=20=200=20=20=20=20=20= 0=20=20=20=20=200)=0A=20=20=20=20=20("blue"=20=20=20=20=20=20=20=20=20=20= =201=20=20=20=20=200=20=20=20=20=200=2052480)=20;=20MediumBlue=0Adiff=20= --git=20a/lisp/term/rxvt.el=20b/lisp/term/rxvt.el=0Aindex=20= 31e3d6ede4..5dc754c8e0=20100644=0A---=20a/lisp/term/rxvt.el=0A+++=20= b/lisp/term/rxvt.el=0A@@=20-206,13=20+206,11=20@@=20= rxvt-set-background-mode=0A=20=20=20=20=20=20=20;;=20The=20next=20line=20= assumes=20that=20rxvt-standard-colors=20are=20ordered=0A=20=20=20=20=20=20= =20;;=20by=20the=20color=20index=20in=20the=20ascending=20order!=0A=20=20= =20=20=20=20=20(setq=20rgb=20(car=20(cddr=20(nth=20bg=20= rxvt-standard-colors))))=0A-=20=20=20=20=20=20;;=20See=20the=20= commentary=20in=20frame-set-background-mode=20about=20the=0A-=20=20=20=20= =20=20;;=20computation=20below.=0A-=20=20=20=20=20=20(if=20(<=20(apply=20= '+=20rgb)=0A-=09=20=20=20=20=20;;=20The=20following=20line=20assumes=20= that=20white=20is=20the=2015th=0A-=09=20=20=20=20=20;;=20color=20in=20= rxvt-standard-colors.=0A-=09=20=20=20=20=20(*=20(apply=20'+=20(car=20= (cddr=20(nth=2015=20rxvt-standard-colors))))=200.6))=0A-=09=20=20= (set-terminal-parameter=20nil=20'background-mode=20'dark)))))=0A+=20=20=20= =20=20=20;;=20The=20following=20line=20assumes=20that=20white=20is=20the=20= 15th=0A+=20=20=20=20=20=20;;=20color=20in=20rxvt-standard-colors.=0A+=20=20= =20=20=20=20(let=20((comp-max=20(float=20(caddr=20(nth=2015=20= rxvt-standard-colors)))))=0A+=20=20=20=20=20=20=20=20(when=20= (color-dark-p=20(mapcar=20(lambda=20(c)=20(/=20c=20comp-max))=20rgb))=0A= +=09=20=20(set-terminal-parameter=20nil=20'background-mode=20'dark))))))=0A= =20=0A=20(provide=20'term/rxvt)=0A=20=0Adiff=20--git=20= a/lisp/term/w32console.el=20b/lisp/term/w32console.el=0Aindex=20= 36e9d896c7..0e9d7c8b5c=20100644=0A---=20a/lisp/term/w32console.el=0A+++=20= b/lisp/term/w32console.el=0A@@=20-86,9=20+86,9=20@@=20= terminal-init-w32console=0A=20=20=20=20=20(setq=20r=20(nth=202=20descr)=0A= =20=09=20=20g=20(nth=203=20descr)=0A=20=09=20=20b=20(nth=204=20descr))=0A= -=20=20=20=20(if=20(<=20(+=20r=20g=20b)=20(*=20.6=20(+=2065535=2065535=20= 65535)))=0A-=09(setq=20bg-mode=20'dark)=0A-=20=20=20=20=20=20(setq=20= bg-mode=20'light))=0A+=20=20=20=20(setq=20bg-mode=20(if=20(color-dark-p=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (list=20(/=20r=2065535.0)=20(/=20g=2065535.0)=20(/=20b=2065535.0)))=0A+=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20'dark=20= 'light))=0A=20=20=20=20=20(set-terminal-parameter=20nil=20= 'background-mode=20bg-mode))=0A=20=20=20(tty-set-up-initial-frame-faces)=0A= =20=20=20(run-hooks=20'terminal-init-w32-hook))=0Adiff=20--git=20= a/lisp/term/xterm.el=20b/lisp/term/xterm.el=0Aindex=20= 1a727e3933..bf9bcae526=20100644=0A---=20a/lisp/term/xterm.el=0A+++=20= b/lisp/term/xterm.el=0A@@=20-1120,9=20+1120,8=20@@=20= xterm-register-default-colors=0A=20=20=20=20=20(clear-face-cache)))=0A=20= =0A=20(defun=20xterm-maybe-set-dark-background-mode=20(redc=20greenc=20= bluec)=0A-=20=20;;=20Use=20the=20heuristic=20in=20= `frame-set-background-mode'=20to=20decide=20if=20a=0A-=20=20;;=20frame=20= is=20dark.=0A-=20=20(when=20(<=20(+=20redc=20greenc=20bluec)=20(*=20.6=20= (+=2065535=2065535=2065535)))=0A+=20=20(when=20(color-dark-p=20(mapcar=20= (lambda=20(c)=20(/=20c=2065535.0))=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(list=20redc=20= greenc=20bluec)))=0A=20=20=20=20=20(set-terminal-parameter=20nil=20= 'background-mode=20'dark)=0A=20=20=20=20=20t))=0A=20=0Adiff=20--git=20= a/lisp/textmodes/css-mode.el=20b/lisp/textmodes/css-mode.el=0Aindex=20= 0035c5e7b0..2cd99787e8=20100644=0A---=20a/lisp/textmodes/css-mode.el=0A= +++=20b/lisp/textmodes/css-mode.el=0A@@=20-1149,17=20+1149,6=20@@=20= css--compute-color=0A=20=20=20=20;;=20Evaluate=20to=20the=20color=20if=20= the=20name=20is=20found.=0A=20=20=20=20((css--named-color=20start-point=20= match))))=0A=20=0A-(defun=20css--contrasty-color=20(name)=0A-=20=20= "Return=20a=20color=20that=20contrasts=20with=20NAME.=0A-NAME=20is=20of=20= any=20form=20accepted=20by=20`color-distance'.=0A-The=20returned=20color=20= will=20be=20usable=20by=20Emacs=20and=20will=20contrast=0A-with=20NAME;=20= in=20particular=20so=20that=20if=20NAME=20is=20used=20as=20a=20= background=0A-color,=20the=20returned=20color=20can=20be=20used=20as=20= the=20foreground=20and=20still=0A-be=20readable."=0A-=20=20;;=20See=20= bug#25525=20for=20a=20discussion=20of=20this.=0A-=20=20(if=20(>=20= (color-distance=20name=20"black")=20292485)=0A-=20=20=20=20=20=20"black"=20= "white"))=0A-=0A=20(defcustom=20css-fontify-colors=20t=0A=20=20=20= "Whether=20CSS=20colors=20should=20be=20fontified=20using=20the=20color=20= as=20the=20background.=0A=20When=20non-`nil',=20a=20text=20representing=20= CSS=20color=20will=20be=20fontified=0A@@=20-1199,7=20+1188,8=20@@=20= css--fontify-region=0A=20=09=09=20=20=20=20(add-text-properties=0A=20=09=09= =20=20=20=20=20start=20(point)=0A=20=09=09=20=20=20=20=20(list=20'face=20= (list=20:background=20color=0A-=09=09=09=09=20=20=20=20=20=20=20= :foreground=20(css--contrasty-color=20color)=0A+=09=09=09=09=20=20=20=20=20= =20=20:foreground=20(readable-foreground-color=0A+=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20color)=0A=20=09=09= =09=09=20=20=20=20=20=20=20:box=20'(:line-width=20-1))))))))))))=0A=20=20= =20=20=20extended-region))=0A=20=0A--=20=0A2.21.1=20(Apple=20Git-122.3)=0A= =0A= --Apple-Mail=_DB782CBA-D227-410A-B6EF-143B5FD5022B--