Skip to content

Commit fdc5c35

Browse files
committed
Merge branch 'upstream_master' into dev
2 parents 9d881e1 + 29012af commit fdc5c35

File tree

10 files changed

+68
-32
lines changed

10 files changed

+68
-32
lines changed

CHANGES.md

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

3+
## 4.1.1
4+
5+
- **FIX**: Fix palette update logic that would not properly format the
6+
version.
7+
8+
## 4.1.0
9+
10+
- **NEW**: Add minimal color support in Sublime's built-in GraphViz
11+
syntax files. Colors are currently limited to hex RGB/RGBA and color
12+
names outside of HTML and full CSS support inside HTML. Support is
13+
experimental, and if false positives are a problem, the rule can be
14+
disabled in the settings.
15+
- **NEW**: Don't default `tmtheme` custom class output to X11 names,
16+
default to hex codes instead.
17+
- **FIX**: Fix some additional custom class issues related to latest
18+
`coloraide` update.
19+
320
## 4.0.1
421

522
- **FIX**: Fix built-in custom color class match return. This caused files

ColorHelper.sublime-settings

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@
206206
"class": "ColorHelper.custom.tmtheme.ColorSRGBX11",
207207
"filters": ["srgb"],
208208
"output": [
209-
{"space": "srgb", "format": {"names": true}}
209+
{"space": "srgb", "format": {}}
210210
]
211211
},
212212
"argb": {
@@ -299,6 +299,34 @@
299299
"meta.tag.any.html meta.attribute-with-value.style.html"
300300
]
301301
},
302+
{
303+
// Setting is experimental, set "enable" to false if false positives are problematic.
304+
//
305+
// GraphViz provides limited scoping that limits our ability to identify exactly
306+
// where colors will and will not appear. It also uses deprecated attributes
307+
// in HTML snippets that do not style the colors with the CSS syntax as HTML normally
308+
// does.
309+
//
310+
// All of this "could" lead to false positives. We do our best to limit scoping as
311+
// much as reasonable. HSV support is currently limited due to the fact the syntax
312+
// is very non-spefic (floats separated by commas or spaces) and is likely to cause
313+
// the most false positives. If the GraphViz syntax were to scope colors with a
314+
// special scope, or at least properties that are likely to contain colors, we
315+
// could greatly reduce/elliminate false positives and add HSV support with more
316+
// confidence.
317+
"name": "Graphviz",
318+
"base_scopes": [
319+
"source.dot"
320+
],
321+
"color_class": [
322+
{"class": "tmtheme", "scopes": "meta.attributes.dot -text.html.basic"},
323+
{"class": "css-level-4", "scopes": "text.html.basic"}
324+
],
325+
"scanning": [
326+
"source.dot meta.attributes.dot -text.html.basic",
327+
"meta.attribute-with-value.html meta.string.html"
328+
]
329+
},
302330
{
303331
"name": "PackageDev Sublime Schemes/Theme",
304332
"syntax_files": [

ch_util.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ def _get_palettes(window=None):
328328
data = window.project_data()
329329
if data is None:
330330
data = {
331-
'color_helper_palettes_format': '.'.join(PALETTE_FMT),
331+
'color_helper_palettes_format': '.'.join(str(x) for x in PALETTE_FMT),
332332
'color_helper_palettes': []
333333
}
334334
color_palettes = data.get('color_helper_palettes', [])
@@ -340,14 +340,14 @@ def _get_palettes(window=None):
340340
p['colors'] = update_colors_1_0(p['colors'])
341341
data['color_helper_palettes'] = color_palettes
342342
fmt = (1, 0)
343-
data['color_helper_palettes_format'] = '.'.join(fmt)
343+
data['color_helper_palettes_format'] = '.'.join(str(x) for x in fmt)
344344
window.set_project_data(data)
345345
if fmt != PALETTE_FMT and coloraide_version >= COLOR_FMT_2_0:
346346
if fmt == (1, 0):
347347
for p in color_palettes:
348348
p['colors'] = update_colors_2_0(p['colors'])
349349
data['color_helper_palettes'] = color_palettes
350-
data['color_helper_palettes_format'] = '.'.join(PALETTE_FMT)
350+
data['color_helper_palettes_format'] = '.'.join(str(x) for x in PALETTE_FMT)
351351
window.set_project_data(data)
352352

353353
palettes = data

custom/ahex.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def to_string(
6565

6666
# Always fit hex
6767
method = None if not isinstance(fit, str) else fit
68-
coords = util.no_nan(parent.fit(method=method).coords())
68+
coords = util.no_nans(parent.fit(method=method).coords())
6969
if show_alpha:
7070
value = template.format(
7171
int(util.round_half_up(a * 255.0)),

custom/ass_abgr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def to_string(self, parent, *, options=None, alpha=None, precision=None, fit=Tru
6161

6262
# Always fit hex
6363
method = None if not isinstance(fit, str) else fit
64-
coords = util.no_nan(parent.fit(method=method).coords())
64+
coords = util.no_nans(parent.fit(method=method).coords())
6565
if show_alpha:
6666
value = template.format(
6767
int(util.round_half_up(a * 255.0)),

custom/hex_0x.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def to_string(
6464
template = template.upper()
6565

6666
method = None if not isinstance(fit, str) else fit
67-
coords = util.no_nan(parent.fit(method=method).coords())
67+
coords = util.no_nans(parent.fit(method=method).coords())
6868
if show_alpha:
6969
value = template.format(
7070
int(util.round_half_up(coords[0] * 255.0)),

custom/tmtheme.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ class SRGBX11(SRGB):
689689
# Hex syntax
690690
\#(?:{hex}{{6}}(?:{hex}{{2}})?|{hex}{{3}}(?:{hex})?)\b |
691691
# Names
692-
\b(?<!\#)[a-z]{{3,}}(?!\()\b
692+
\b(?<!\#)[a-z][a-z0-9]{{2,}}(?!\()\b
693693
)
694694
""".format(**parse.COLOR_PARTS)
695695
)
@@ -707,7 +707,7 @@ def to_string(
707707
hex_upper = options.get("upper", False)
708708
compress = options.get("compress", False)
709709
method = None if not isinstance(fit, str) else fit
710-
coords = util.no_nan(parent.fit(method=method).coords())
710+
coords = util.no_nans(parent.fit(method=method).coords())
711711

712712
template = "#{:02x}{:02x}{:02x}{:02x}" if alpha else "#{:02x}{:02x}{:02x}"
713713
if hex_upper:
@@ -759,7 +759,7 @@ def match(cls, string, start=0, fullmatch=True):
759759
if m is not None and (not fullmatch or m.end(0) == len(string)):
760760
string = string[m.start(0):m.end(0)].lower()
761761
if not string.startswith("#"):
762-
string = name2hex(string[m.start(0):m.end(0)])
762+
string = name2hex(string)
763763
if string is not None:
764764
return cls.split_channels(string), m.end(0)
765765
return None

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-
"4.0.0": "messages/recent.md"
3+
"4.1.0": "messages/recent.md"
44
}

messages/recent.md

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# ColorHelper 4.0.0
1+
# ColorHelper 4.1.0
22

33
New release!
44

@@ -7,23 +7,14 @@ prior releases.
77

88
Restart of Sublime Text may be required.
99

10-
## 4.0.0
10+
## 4.1.0
1111

12-
> **BREAKING CHANGE**
13-
> If you have defined custom colors rules and specifically reference `xyz`
14-
> rules should be updated to refer to `xyz` as `xyz-d65`.
15-
16-
- **NEW**: Update to latest `coloraide` which provides minor bug fixes.
17-
As the new version now includes type annotations, ColorHelper now
18-
requires the `typing` dependency until it can be migrated to use Python
19-
3.8. Typing refactor did moderately affect custom color classes.
20-
- **NEW**: `xyz` is now known as `xyz-d65` in the settings file.
21-
If you have custom rules that override or add `xyz`, please update
22-
the rules to reference `xyz-d65` instead.
23-
- **NEW**: Gamut mapping now uses Oklch instead of CIE LCH per CSS recnet
24-
specifications changes to the CSS Level 4 specification.
25-
- **NEW**: Expose sRGB Linear color space per the CSS specification.
26-
- **FIX**: Fix `blend` and `blenda` regression in emulation of Sublime's
27-
ColorMod implementation.
28-
- **FIX**: ColorPicker should not show colors maps with opacity in the
29-
color map square.
12+
- **NEW**: Add minimal color support in Sublime's built-in GraphViz
13+
syntax files. Colors are currently limited to hex RGB/RGBA and color
14+
names outside of HTML and full CSS support inside HTML. Support is
15+
experimental, and if false positives are a problem, the rule can be
16+
disabled in the settings.
17+
- **NEW**: Don't default `tmtheme` custom class output to X11 names,
18+
default to hex codes instead.
19+
- **FIX**: Fix some additional custom class issues related to latest
20+
`coloraide` update.

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__ = "4.0.1"
8+
__version__ = "4.1.1"
99
__pc_name__ = 'ColorHelper'
1010

1111
CSS = '''

0 commit comments

Comments
 (0)