unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Etienne Prud'homme <e.e.f.prudhomme@gmail.com>
To: "Simen Heggestøyl" <simenheg@gmail.com>
Cc: 23383@debbugs.gnu.org
Subject: bug#23383: [PATCH] Support completion of color functions in CSS mode
Date: Fri, 20 May 2016 15:37:28 -0400	[thread overview]
Message-ID: <20160520153728.612ac2bd@thinkpax> (raw)
In-Reply-To: <1461865897.9211.0@smtp.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1693 bytes --]

I've attached the current patch.

> - I think we should stick to the current CSS Color Module Level 3
>   recommendation [1]. The functions apart from `rgb()', `rgba()',
>   `hsl()', and `hsla()' are only present in an Editor's Draft. I find
> no other resources about them, so I don't think we should include them
>   until the new spec becomes at least a Candidate Recommendation.
Thanks. I didn't realize the high probability most of them won't be in
the recommendation

> - I think there's little use in completing `#' since it's only one
>   character.

I was also thinking the same thing. I interpreted: "and so
on, then `hex-color'" too literally.

> - `namedColor' must be changed to `named-color' to match the name of
> the value class.
Thanks for pointing that out.

> - The new color names need to be double-checked. For instance I see
> that `limegreen' has become `limeg een' and `salmon' has become `sa
> mon'.
I made the list with a macro. I was too tired to double check 140
colors. The current list was generated from Dough Crockford's color
list [1] using:

| var list = "";
| for(var i=0, len=colors.length; i<len; i++)
|     list += '"' + colors[i] + '" ';

`colors` needs to be extracted from the Immediately-invoked function
expression [2].

> - The test `css-test-property-values' in
>   test/lisp/textmodes/css-mode-tests.el needs a small update.

I updated the list length to 147 since there's 141
namedColors and 6 values in color. However, I can't make the test
execute since my Git repository is broken and the remote doesn't work
as of now.

Thanks for your patience.

[1] http://www.crockford.com/wrrrld/color.html
[2] https://en.wikipedia.org/wiki/IIFE

Etienne

[-- Attachment #2: 0001-Add-completion-of-colors-in-CSS-mode.patch --]
[-- Type: text/x-patch, Size: 3693 bytes --]

From 3e000ab30b3c6a4cd8cc1f76bd98c5f7c5aa0c30 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Etienne=20Prud=E2=80=99homme?= <e.e.f.prudhomme@gmail.com>
Date: Wed, 27 Apr 2016 19:52:28 -0400
Subject: [PATCH] Add completion of colors in CSS mode

* lisp/textmodes/css-mode.el (css-value-class-alist): Add CSS colors
  candidates from "CSS Color Module Level 4".
---
 lisp/textmodes/css-mode.el | 38 ++++++++++++++++++++++++++++++++++----
 1 file changed, 34 insertions(+), 4 deletions(-)

diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el
index e30fb3e..3b795fd 100644
--- a/lisp/textmodes/css-mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -460,10 +460,9 @@ css-value-class-alist
     (bg-layer bg-image position repeat-style attachment box)
     (bg-size length percentage "auto" "cover" "contain")
     (box "border-box" "padding-box" "content-box")
-    (color
-     "aqua" "black" "blue" "fuchsia" "gray" "green" "lime" "maroon"
-     "navy" "olive" "orange" "purple" "red" "silver" "teal" "white"
-     "yellow" "transparent")
+    (color "rgb()" "rgba()" "hsl()" "hsla()" "hwb()" "gray()" "lab()"
+           "lch()" "device-cmyk()" "color-mod()" "#" namedColor
+           "transparent" "currentColor")
     (common-lig-values "common-ligatures" "no-common-ligatures")
     (contextual-alt-values "contextual" "no-contextual")
     (counter "counter()" "counters()")
@@ -502,6 +501,37 @@ css-value-class-alist
     (line-width length "thin" "medium" "thick")
     (linear-gradient "linear-gradient()")
     (margin-width "auto" length percentage)
+    (named-color
+     "aliceblue" "antiquewhite" "aqua" "aquamarine" "azure" "beige"
+     "bisque" "black" "blanchedalmond" "blue" "blueviolet" "brown"
+     "burlywood" "cadetblue" "chartreuse" "chocolate" "coral"
+     "cornflowerblue" "cornsilk" "crimson" "cyan" "darkblue"
+     "darkcyan" "darkgoldenrod" "darkgray" "darkgreen" "darkgrey"
+     "darkkhaki" "darkmagenta" "darkolivegreen" "darkorange"
+     "darkorchid" "darkred" "darksalmon" "darkseagreen"
+     "darkslateblue" "darkslategray" "darkslategrey" "darkturquoise"
+     "darkviolet" "deeppink" "deepskyblue" "dimgray" "dimgrey"
+     "dodgerblue" "firebrick" "floralwhite" "forestgreen" "fuchsia"
+     "gainsboro" "ghostwhite" "gold" "goldenrod" "gray" "green"
+     "greenyellow" "grey" "honeydew" "hotpink" "indianred" "indigo"
+     "ivory" "khaki" "lavender" "lavenderblush" "lawn reen"
+     "lemonchiffon" "lightblue" "lightcoral" "lightcyan"
+     "lightgoldenrodyellow" "lightgray" "lightgreen" "lightgrey"
+     "lightpi k" "lightsalmon" "lightseagreen" "lightskyblue"
+     "lightslategray" "lightslategrey" "lightsteelblue" "lightyellow"
+     "lime" "limeg een" "linen" "magenta" "maroon" "mediumaquamarine"
+     "mediumblue" "mediumorchid" "mediumpurple" "mediumseagreen"
+     "mediumslateblu " "mediumspringgreen" "mediumturquoise"
+     "mediumvioletred" "midnightblue" "mintcream" "mistyrose"
+     "moccasin" "navajowhite" "nav " "oldlace" "olive" "olivedrab"
+     "orange" "orangered" "orchid" "palegoldenrod" "palegreen"
+     "paleturquoise" "palevioletred" "pap yawhip" "peachpuff" "peru"
+     "pink" "plum" "powderblue" "purple" "rebeccapurple" "red"
+     "rosybrown" "royalblue" "saddlebrown" "sa mon" "sandybrown"
+     "seagreen" "seashell" "sienna" "silver" "skyblue" "slateblue"
+     "slategray" "slategrey" "snow" "springgreen" " teelblue" "tan"
+     "teal" "thistle" "tomato" "turquoise" "violet" "wheat" "white"
+     "whitesmoke" "yellow" "yellowgreen")
     (number "calc()")
     (numeric-figure-values "lining-nums" "oldstyle-nums")
     (numeric-fraction-values "diagonal-fractions" "stacked-fractions")
-- 
2.8.1


  reply	other threads:[~2016-05-20 19:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-26 22:48 bug#23383: [PATCH] Support completion of color functions in CSS mode Etienne Prud'homme
2016-04-27 19:16 ` Simen Heggestøyl
2016-04-28  0:17   ` Etienne Prud'homme
2016-04-28 17:51     ` Simen Heggestøyl
2016-05-20 19:37       ` Etienne Prud'homme [this message]
2016-05-21 10:42         ` Simen Heggestøyl
2016-05-21 22:43           ` Etienne Prud'homme
2016-05-22 11:03             ` Simen Heggestøyl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160520153728.612ac2bd@thinkpax \
    --to=e.e.f.prudhomme@gmail.com \
    --cc=23383@debbugs.gnu.org \
    --cc=simenheg@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).