Skip to content

Commit 7fb264d

Browse files
committed
Fix SCSS/CSS/SASS/HTML Color targeting
1 parent c414d36 commit 7fb264d

5 files changed

Lines changed: 45 additions & 69 deletions

File tree

CHANGES.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# ColorHelper
22

3+
## 6.7.0
4+
5+
- **NEW**: Rework HTML, CSS, SCSS, SASS handling. As syntax packages
6+
have evolved, rework rules to better target colors, combining
7+
handling under one rule `HTML/CSS`.
8+
- **NEW**: Move handling for old, CSS3 syntax to its own rule.
9+
310
## 6.6.0
411

512
- **NEW**: Upgrade to ColorAide 7.0.

color_helper.sublime-settings

Lines changed: 31 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -354,23 +354,45 @@
354354
//
355355
//.- `enable`: This can be used to disable a color rule entirely. Defaults to `true`.
356356
"color_rules": [
357+
{
358+
"name": "CSS3",
359+
"base_scopes": [
360+
"source.css"
361+
],
362+
"syntax_files": [
363+
"CSS3/CSS3"
364+
],
365+
"color_class": "css-level-4",
366+
"scanning": [
367+
// https://packagecontrol.io/packages/CSS3
368+
"support.constant.color.w3c-color-name.css",
369+
"support.function.color-adjuster-rgb.css",
370+
"constant.other.color.rgb-value.css",
371+
"support.function.color.css",
372+
"support.function.rgba.css",
373+
"support.function.hsla.css",
374+
"support.function.hwb.css",
375+
"support.function.lab.css",
376+
"support.function.lch.css"
377+
]
378+
},
357379
{
358380
"name": "HTML/CSS",
359381
"base_scopes": [
360382
"source.css",
383+
"source.sass",
384+
"source.scss",
361385
"text.html"
362386
],
363387
"color_class": "css-level-4",
364388
"scanning": [
365-
// https://packagecontrol.io/packages/CSS3
366-
"meta.declaration-list.css -support.type.property-name.css -comment -string",
367-
// CSS, CSS in HTML etc. (based on: Sublime Default)
368-
"meta.property-value.css -comment -string",
369-
// CSS3, CSS3 in HTML etc. (based on: https://packagecontrol.io/packages/CSS3)
370-
"meta.value.css -comment -string",
371-
// HTML attributes (based on: Sublime Default)
372-
"meta.tag.inline.any.html string.quoted -constant.character.entity.html",
373-
"meta.tag.any.html meta.attribute-with-value.style.html"
389+
// Sublime default CSS nand HTML. Covers SCSS, POSTCSS, and most of SASS
390+
"support.constant.color.w3c.standard.css",
391+
"support.constant.color.w3c.extended.css",
392+
"support.function.color.css",
393+
"constant.other.color.rgb-value.css, constant.other.color.rgba-value.css",
394+
// https://packagecontrol.io/packages/SASS
395+
"support.function.custom.sass"
374396
]
375397
},
376398
{
@@ -426,62 +448,6 @@
426448
"meta.css.sublime-color-scheme meta.property-value.css -comment -string.quoted.single.css -string.quoted.double.css"
427449
]
428450
},
429-
{
430-
// Sass (based on: https://packagecontrol.io/packages/Sass)
431-
"name": "Sass",
432-
"syntax_files": ["Sass/Syntaxes/Sass", "Sass/Syntaxes/SCSS"],
433-
"base_scopes": [
434-
"source.sass",
435-
"source.scss"
436-
],
437-
"color_class": "css-level-4",
438-
"scanning": [
439-
"source.sass meta.property-value.css -comment -string -variable.declaration.sass",
440-
"source.scss meta.property-value.css -comment -string -variable.declaration.sass",
441-
"source.scss meta.declaration.value.scss -comment -string -variable.declaration.sass"
442-
]
443-
},
444-
{
445-
// SCSS (based on https://packagecontrol.io/packages/SCSS)
446-
"name": "SCSS",
447-
"syntax_files": ["SCSS/SCSS"],
448-
"base_scopes": [
449-
"source.scss"
450-
],
451-
"color_class": "css-level-4",
452-
"scanning": [
453-
"source.scss -comment -string"
454-
]
455-
},
456-
{
457-
// SCSS (based on https://packagecontrol.io/packages/Syntax%20Highlighting%20for%20Sass)
458-
"name": "Syntax Highlighting for Sass",
459-
"syntax_files": [
460-
"Syntax Highlighting for Sass/Syntaxes/SCSS",
461-
"Syntax Highlighting for Sass/Syntaxes/Sass"
462-
],
463-
"base_scopes": [
464-
"source.scss",
465-
"source.sass"
466-
],
467-
"color_class": "css-level-4",
468-
"scanning": [
469-
"source.scss -comment -string -support.type.property-name -variable.declaration",
470-
"source.sass -comment -string -support.type.property-name -variable.declaration"
471-
]
472-
},
473-
{
474-
// Sass (based on: https://packagecontrol.io/packages/Syntax%20Highlighting%20for%20PostCSS)
475-
"name": "PostCSS",
476-
"syntax_files": ["Syntax Highlighting for PostCSS/Syntaxes/PostCSS"],
477-
"base_scopes": [
478-
"source.postcss"
479-
],
480-
"color_class": "css-level-4",
481-
"scanning": [
482-
"source.postcss meta.property-list.css.postcss -comment -string"
483-
]
484-
},
485451
{
486452
"name": "tmTheme",
487453
"color_trigger": "(?i)(?:\\b(?<![-#&$])[\\w]{3,}(?![(-])\\b|(?!<&)\\#)",

messages.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"install": "messages/install.md",
3-
"6.6.0": "messages/recent.md"
3+
"6.7.0": "messages/recent.md"
44
}

messages/recent.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ A restart of Sublime Text is **strongly** encouraged.
1010
Please report any issues as we _might_ have missed some required updates
1111
related to the upgrade to stable `coloraide`.
1212

13-
## 6.6.0
13+
## 6.7.0
1414

15-
- **NEW**: Upgrade to ColorAide 7.0.
15+
- **NEW**: Rework HTML, CSS, SCSS, SASS handling. As syntax packages
16+
have evolved, rework rules to better target colors, combining
17+
handling under one rule `HTML/CSS`.
18+
- **NEW**: Move handling for old, CSS3 syntax to its own rule.

support.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import webbrowser
66
import re
77

8-
__version__ = "6.5.1"
8+
__version__ = "6.7.0"
99
__pc_name__ = 'ColorHelper'
1010

1111
CSS = '''

0 commit comments

Comments
 (0)