Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit c32fa5f

Browse files
committed
Merge pull request #10410 from MarcelGerber/css-hints-color
Hint color names in CSS Code Hints
2 parents f9cd4f7 + 3ed19e6 commit c32fa5f

2 files changed

Lines changed: 18 additions & 12 deletions

File tree

src/extensions/default/CSSCodeHints/CSSProperties.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@
1616
"background-attachment": {"values": ["fixed", "local", "scroll", "inherit"]},
1717
"background-blend-mode": {"values": ["color", "color-burn", "color-dodge", "darken", "difference", "exclusion", "hard-light", "hue", "lighten", "luminosity", "normal", "multiply", "overlay", "saturation", "screen", "soft-light"]},
1818
"background-clip": {"values": ["border-box", "content-box", "padding-box", "inherit"]},
19-
"background-color": {"values": ["currentColor", "transparent", "inherit"]},
19+
"background-color": {"values": ["inherit"], "type": "color"},
2020
"background-image": {"values": ["image()", "linear-gradient()", "radial-gradient()", "repeating-linear-gradient()", "repeating-radial-gradient()", "url()"]},
2121
"background-origin": {"values": ["border-box", "content-box", "padding-box", "inherit"]},
2222
"background-position": {"values": ["left", "center", "right", "bottom", "top"]},
2323
"background-repeat": {"values": ["no-repeat", "repeat", "repeat-x", "repeat-y", "round", "space"]},
2424
"background-size": {"values": ["auto", "contain", "cover"]},
2525
"border": {"values": []},
2626
"border-collapse": {"values": ["collapse", "separate", "inherit"]},
27-
"border-color": {"values": ["currentColor", "transparent", "inherit"]},
27+
"border-color": {"values": ["inherit"], "type": "color"},
2828
"border-spacing": {"values": ["inherit"]},
2929
"border-style": {"values": ["dashed", "dotted", "double", "groove", "hidden", "inset", "none", "outset", "ridge", "solid", "inherit"]},
3030
"border-bottom": {"values": []},
31-
"border-bottom-color": {"values": ["currentColor", "transparent", "inherit"]},
31+
"border-bottom-color": {"values": ["inherit"], "type": "color"},
3232
"border-bottom-left-radius": {"values": []},
3333
"border-bottom-right-radius": {"values": []},
3434
"border-bottom-style": {"values": ["dashed", "dotted", "double", "groove", "hidden", "inset", "none", "outset", "ridge", "solid", "inherit"]},
@@ -40,16 +40,16 @@
4040
"border-image-repeat": {"values": ["repeat", "round", "space", "stretch"]},
4141
"border-image-width": {"values": ["auto"]},
4242
"border-left": {"values": []},
43-
"border-left-color": {"values": ["currentColor", "transparent", "inherit"]},
43+
"border-left-color": {"values": ["inherit"], "type": "color"},
4444
"border-left-style": {"values": ["dashed", "dotted", "double", "groove", "hidden", "inset", "none", "outset", "ridge", "solid", "inherit"]},
4545
"border-left-width": {"values": ["medium", "thin", "thick", "inherit"]},
4646
"border-radius": {"values": []},
4747
"border-right": {"values": []},
48-
"border-right-color": {"values": ["currentColor", "transparent", "inherit"]},
48+
"border-right-color": {"values": ["inherit"], "type": "color"},
4949
"border-right-style": {"values": ["dashed", "dotted", "double", "groove", "hidden", "inset", "none", "outset", "ridge", "solid", "inherit"]},
5050
"border-right-width": {"values": ["medium", "thin", "thick", "inherit"]},
5151
"border-top": {"values": []},
52-
"border-top-color": {"values": ["currentColor", "transparent", "inherit"]},
52+
"border-top-color": {"values": ["inherit"], "type": "color"},
5353
"border-top-left-radius": {"values": []},
5454
"border-top-right-radius": {"values": []},
5555
"border-top-style": {"values": ["dashed", "dotted", "double", "groove", "hidden", "inset", "none", "outset", "ridge", "solid", "inherit"]},
@@ -65,13 +65,13 @@
6565
"caption-side": {"values": ["bottom", "top", "inherit"]},
6666
"clear": {"values": ["both", "left", "none", "right", "inherit"]},
6767
"clip": {"values": ["auto", "inherit"]},
68-
"color": {"values": ["inherit"]},
68+
"color": {"values": ["inherit"], "type": "color"},
6969
"columns": {"values": []},
7070
"column-count": {"values": []},
7171
"column-fill": {"values": ["auto", "balance"]},
7272
"column-gap": {"values": ["normal"]},
7373
"column-rule": {"values": []},
74-
"column-rule-color": {"values": ["currentColor"]},
74+
"column-rule-color": {"values": [], "type": "color"},
7575
"column-rule-style": {"values": ["dashed", "dotted", "double", "groove", "hidden", "inset", "none", "outset", "ridge", "solid", "inherit"]},
7676
"column-rule-width": {"values": ["medium", "thin", "thick", "inherit"]},
7777
"column-span": {"values": ["all", "none"]},
@@ -139,7 +139,7 @@
139139
"order": {"values": []},
140140
"orphans": {"values": ["inherit"]},
141141
"outline": {"values": ["inherit"]},
142-
"outline-color": {"values": ["invert", "inherit"]},
142+
"outline-color": {"values": ["invert", "inherit"], "type": "color"},
143143
"outline-offset": {"values": ["inherit"]},
144144
"outline-style": {"values": ["dashed", "dotted", "double", "groove", "hidden", "inset", "none", "outset", "ridge", "solid", "inherit"]},
145145
"outline-width": {"values": ["medium", "thin", "thick", "inherit"]},
@@ -174,12 +174,12 @@
174174
"text-align": {"values": ["center", "left", "justify", "right", "inherit"]},
175175
"text-align-last": {"values": ["center", "left", "justify", "right", "inherit"]},
176176
"text-decoration": {"values": ["line-through", "none", "overline", "underline", "inherit"]},
177-
"text-decoration-color": {"values": ["currentColor"]},
177+
"text-decoration-color": {"values": [], "type": "color"},
178178
"text-decoration-line": {"values": ["line-through", "none", "overline", "underline"]},
179179
"text-decoration-skip": {"values": ["edges", "ink", "none", "objects", "spaces"]},
180180
"text-decoration-style": {"values": ["dashed", "dotted", "double", "solid", "wavy"]},
181181
"text-emphasis": {"values": []},
182-
"text-emphasis-color": {"values": ["currentColor"]},
182+
"text-emphasis-color": {"values": [], "type": "color"},
183183
"text-emphasis-position": {"values": ["above", "below", "left", "right"]},
184184
"text-emphasis-style": {"values": ["circle", "dot", "double-circle", "filled", "none", "open", "sesame", "triangle"]},
185185
"text-indent": {"values": ["inherit"]},

src/extensions/default/CSSCodeHints/main.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ define(function (require, exports, module) {
3535
LanguageManager = brackets.getModule("language/LanguageManager"),
3636
TokenUtils = brackets.getModule("utils/TokenUtils"),
3737
StringMatch = brackets.getModule("utils/StringMatch"),
38+
ColorUtils = brackets.getModule("utils/ColorUtils"),
3839
CSSProperties = require("text!CSSProperties.json"),
3940
properties = JSON.parse(CSSProperties);
4041

@@ -241,6 +242,7 @@ define(function (require, exports, module) {
241242
valueNeedle = "",
242243
context = this.info.context,
243244
valueArray,
245+
type,
244246
namedFlows,
245247
result,
246248
selectInitial = false;
@@ -272,7 +274,8 @@ define(function (require, exports, module) {
272274
}
273275

274276
valueArray = properties[needle].values;
275-
if (properties[needle].type === "named-flow") {
277+
type = properties[needle].type;
278+
if (type === "named-flow") {
276279
namedFlows = this.getNamedFlows();
277280

278281
if (valueNeedle.length === this.info.offset && namedFlows.indexOf(valueNeedle) !== -1) {
@@ -282,6 +285,9 @@ define(function (require, exports, module) {
282285
}
283286

284287
valueArray = valueArray.concat(namedFlows);
288+
} else if (type === "color") {
289+
valueArray = valueArray.concat(ColorUtils.COLOR_NAMES);
290+
valueArray.push("transparent", "currentColor");
285291
}
286292

287293
result = $.map(valueArray, function (pvalue, pindex) {

0 commit comments

Comments
 (0)