* bug#30377: 27.0.50; Missing and misspelled SHR/CSS colors
@ 2018-02-07 3:37 Basil L. Contovounesios
2018-02-07 9:45 ` Simen Heggestøyl
2018-02-07 15:03 ` Tom Tromey
0 siblings, 2 replies; 5+ messages in thread
From: Basil L. Contovounesios @ 2018-02-07 3:37 UTC (permalink / raw)
To: 30377; +Cc: Julien Danjou, Tom Tromey, Simen Heggestøyl
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: 0001-Fix-shr-and-CSS-4-color-maps.patch --]
[-- Type: text/x-diff, Size: 2196 bytes --]
From abb1b62bb2cda93cc902d06dd438a37fdcb1a7cf Mon Sep 17 00:00:00 2001
From: "Basil L. Contovounesios" <contovob@tcd.ie>
Date: Wed, 7 Feb 2018 02:49:08 +0000
Subject: [PATCH] Fix shr and CSS 4 color maps
* lisp/net/shr-color.el (shr-color-html-colors-alist): Fix typos.
Add RebeccaPurple.
* lisp/textmodes/css-mode.el (css--color-map): Add fuchsia-magenta
and aqua-cyan aliases.
---
lisp/net/shr-color.el | 5 +++--
lisp/textmodes/css-mode.el | 2 ++
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/lisp/net/shr-color.el b/lisp/net/shr-color.el
index 31f3d46ed6..6303141c89 100644
--- a/lisp/net/shr-color.el
+++ b/lisp/net/shr-color.el
@@ -137,7 +137,7 @@ shr-color-html-colors-alist
("MediumAquaMarine" . "#66CDAA")
("MediumBlue" . "#0000CD")
("MediumOrchid" . "#BA55D3")
- ("MediumPurple" . "#9370D8")
+ ("MediumPurple" . "#9370DB")
("MediumSeaGreen" . "#3CB371")
("MediumSlateBlue" . "#7B68EE")
("MediumSpringGreen" . "#00FA9A")
@@ -158,7 +158,7 @@ shr-color-html-colors-alist
("PaleGoldenRod" . "#EEE8AA")
("PaleGreen" . "#98FB98")
("PaleTurquoise" . "#AFEEEE")
- ("PaleVioletRed" . "#D87093")
+ ("PaleVioletRed" . "#DB7093")
("PapayaWhip" . "#FFEFD5")
("PeachPuff" . "#FFDAB9")
("Peru" . "#CD853F")
@@ -166,6 +166,7 @@ shr-color-html-colors-alist
("Plum" . "#DDA0DD")
("PowderBlue" . "#B0E0E6")
("Purple" . "#800080")
+ ("RebeccaPurple" . "#663399")
("Red" . "#FF0000")
("RosyBrown" . "#BC8F8F")
("RoyalBlue" . "#4169E1")
diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el
index 55c21f8acb..727bc18ebb 100644
--- a/lisp/textmodes/css-mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -499,6 +499,7 @@ css--color-map
("red" . "#ff0000")
("purple" . "#800080")
("fuchsia" . "#ff00ff")
+ ("magenta" . "#ff00ff")
("green" . "#008000")
("lime" . "#00ff00")
("olive" . "#808000")
@@ -507,6 +508,7 @@ css--color-map
("blue" . "#0000ff")
("teal" . "#008080")
("aqua" . "#00ffff")
+ ("cyan" . "#00ffff")
("orange" . "#ffa500")
("aliceblue" . "#f0f8ff")
("antiquewhite" . "#faebd7")
--
2.15.1
[-- Attachment #2: Type: text/plain, Size: 2050 bytes --]
I attach a patch to fix the following minor issues.
1. The variable shr-color-html-colors-alist from lisp/net/shr-color.el
is missing the CSS 4 colour RebeccaPurple and contains typos in the
hex value of colours MediumPurple and PaleVioletRed.
2. The variable css--color-map from lisp/textmodes/css-mode.el is
missing the magenta and cyan aliases of fuchsia and aqua,
respectively.
I have taken the liberty of CCing the authors of these features both for
comment on this patch, but more importantly to address Eli's question
from bug#25525 anew:
> I wonder whether it would make sense to reuse some existing data and
> code here?
In that bug report, which introduced css--color-map, Eli was referring
to the list of colours in lisp/term/tty-colors.el. I would instead like
to draw attention to the overlap between css--color-map and
shr-color-html-colors-alist.
In particular, applying the patch proposed herein satisfies the
following condition:
(seq-set-equal-p
css--color-map
shr-color-html-colors-alist
(lambda (a b)
(and (eq t (compare-strings (car a) nil nil (car b) nil nil t))
(eq t (compare-strings (cdr a) nil nil (cdr b) nil nil t)))))
In other words, css--color-map and shr-color-html-colors-alist become
identical, bar letter case. I have additionally cross-checked the
updated maps with the latest CSS spec[1] and did not find any other
omissions.
[1] https://www.w3.org/TR/css-color-4/.
So, would it be reasonable for one mode to reuse the map of the other?
A (very) cursory glance through bug#25525 and lisp/net/shr-color.el
suggests there may be some further code duplication pertaining to colour
distances; is this so?
Thanks (and apologies if the noise is unjustified),
--
Basil
In GNU Emacs 27.0.50 (build 4, x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
of 2018-02-03 built on thunk
Repository revision: 84c9dba4cee052b68b194c3a2e5c297a94d8c8af
Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
System Description: Debian GNU/Linux buster/sid
^ permalink raw reply related [flat|nested] 5+ messages in thread
* bug#30377: 27.0.50; Missing and misspelled SHR/CSS colors
2018-02-07 3:37 bug#30377: 27.0.50; Missing and misspelled SHR/CSS colors Basil L. Contovounesios
@ 2018-02-07 9:45 ` Simen Heggestøyl
2018-02-07 18:22 ` Eli Zaretskii
2018-02-07 15:03 ` Tom Tromey
1 sibling, 1 reply; 5+ messages in thread
From: Simen Heggestøyl @ 2018-02-07 9:45 UTC (permalink / raw)
To: Basil L. Contovounesios; +Cc: Julien Danjou, Tom Tromey, 30377
[-- Attachment #1: Type: text/plain, Size: 267 bytes --]
Thanks Basil, good catches. The patch looks good to me. I suppose it's
OK for emacs-26, Eli?
I agree that it looks like the two color lists can easily be unified
later and that there seems to be more opportunities for reuse by
css-mode.el in shr-color.el.
-- Simen
[-- Attachment #2: Type: text/html, Size: 393 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#30377: 27.0.50; Missing and misspelled SHR/CSS colors
2018-02-07 3:37 bug#30377: 27.0.50; Missing and misspelled SHR/CSS colors Basil L. Contovounesios
2018-02-07 9:45 ` Simen Heggestøyl
@ 2018-02-07 15:03 ` Tom Tromey
1 sibling, 0 replies; 5+ messages in thread
From: Tom Tromey @ 2018-02-07 15:03 UTC (permalink / raw)
To: Basil L. Contovounesios
Cc: Julien Danjou, Tom Tromey, 30377, Simen Heggestøyl
>>>>> "Basil" == Basil L Contovounesios <contovob@tcd.ie> writes:
Basil> * lisp/textmodes/css-mode.el (css--color-map): Add fuchsia-magenta
Basil> and aqua-cyan aliases.
Thanks. According to MDN these are the only non-grey/gray aliases.
Maybe they weren't on whatever list I started with for that reason.
Basil> In that bug report, which introduced css--color-map, Eli was referring
Basil> to the list of colours in lisp/term/tty-colors.el. I would instead like
Basil> to draw attention to the overlap between css--color-map and
Basil> shr-color-html-colors-alist.
Yes, I wasn't aware of this list from shr. It seems to me that shr
ought to use exactly the CSS colors, so the lists can be shared.
Though, I recommend contacting Lars before doing anything.
Basil> A (very) cursory glance through bug#25525 and lisp/net/shr-color.el
Basil> suggests there may be some further code duplication pertaining to colour
Basil> distances; is this so?
It seems so but I've mostly forgotten whatever I knew about this area.
What I do remember is checking my original algorithm against the one Eli
suggested, by comparing all the CSS named colors with their backgrounds;
and concluding that the one Eli suggested (built in to Emacs) was just
as good. So perhaps shr is doing too much work here as well.
Tom
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#30377: 27.0.50; Missing and misspelled SHR/CSS colors
2018-02-07 9:45 ` Simen Heggestøyl
@ 2018-02-07 18:22 ` Eli Zaretskii
2018-02-07 21:19 ` Simen Heggestøyl
0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2018-02-07 18:22 UTC (permalink / raw)
To: Simen Heggestøyl; +Cc: contovob, julien, tom, 30377
> Date: Wed, 07 Feb 2018 10:45:02 +0100
> From: Simen Heggestøyl <simenheg@gmail.com>
> Cc: 30377@debbugs.gnu.org, Tom Tromey <tom@tromey.com>, Julien Danjou
> <julien@danjou.info>, Eli Zaretskii <eliz@gnu.org>
>
> Thanks Basil, good catches. The patch looks good to me. I suppose it's
> OK for emacs-26, Eli?
Yes, thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#30377: 27.0.50; Missing and misspelled SHR/CSS colors
2018-02-07 18:22 ` Eli Zaretskii
@ 2018-02-07 21:19 ` Simen Heggestøyl
0 siblings, 0 replies; 5+ messages in thread
From: Simen Heggestøyl @ 2018-02-07 21:19 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: contovob, julien, tom, 30377-done
[-- Attachment #1: Type: text/plain, Size: 190 bytes --]
I've installed the patch, thanks again, Basil.
I'm closing this ticket, but I think the discussion regarding color
distances could continue naturally at the still-open Bug#30295.
-- Simen
[-- Attachment #2: Type: text/html, Size: 296 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-02-07 21:19 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-07 3:37 bug#30377: 27.0.50; Missing and misspelled SHR/CSS colors Basil L. Contovounesios
2018-02-07 9:45 ` Simen Heggestøyl
2018-02-07 18:22 ` Eli Zaretskii
2018-02-07 21:19 ` Simen Heggestøyl
2018-02-07 15:03 ` Tom Tromey
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.