Skip to content

Commit 2347576

Browse files
authored
Extend theme converter to allow multimatching against vscode colors (#3294)
[[PR Description]] Adds the ability to specify a vec of VScode syntax scopes to match against for a given syntax style. Example: ```rust pub fn to_vscode(&self) -> Vec<&'static str> { use ZedSyntaxToken::*; match self { SyntaxAttribute => vec!["entity.other.attribute-name"], SyntaxBoolean => vec!["constant.language"], SyntaxComment => vec!["comment"], SyntaxCommentDoc => vec!["comment.block.documentation"], SyntaxConstant => vec!["constant.character"], SyntaxConstructor => vec!["entity.name.function.definition.special.constructor"], SyntaxEmbedded => vec!["meta.embedded"], SyntaxEmphasis => vec!["markup.italic"], SyntaxEmphasisStrong => vec![ "markup.bold", "markup.italic markup.bold", "markup.bold markup.italic", ], SyntaxEnum => vec!["support.type.enum"], SyntaxFunction => vec![ "entity.name.function", "variable.function", "support.function", ], SyntaxKeyword => vec!["keyword"], SyntaxLabel => vec![ "label", "entity.name", "entity.name.import", "entity.name.package", ], // .. more styles }} ``` Useful `settings.json` for testing themes: ```json5 { // --- Dark Themes --- "theme": "Ayu Dark" // "theme": "Ayu Mirage" // "theme": "Dracula" // "theme": "Gruvbox Dark Hard" // "theme": "Gruvbox Dark Medium" // "theme": "Gruvbox Dark Soft" // "theme": "Night Owl" // "theme": "Noctis Obscuro" // "theme": "Noctis" // "theme": "Nord" // "theme": "Palenight (Mild Contrast)" // "theme": "Palenight Operator" // "theme": "Palenight" // "theme": "Rose Pine Moon" // "theme": "Rose Pine" // "theme": "Solarized Dark" // "theme": "Synthwave 84" // --- Light Themes --- // "theme": "Ayu Light" // "theme": "Gruvbox Light Hard" // "theme": "Gruvbox Light Medium" // "theme": "Gruvbox Light Soft" // "theme": "Noctis Lux" // "theme": "Rose Pine Dawn" // "theme": "Solarized Light" } ``` Release Notes: - N/A
2 parents 7586ef1 + 6b65aca commit 2347576

21 files changed

+4131
-952
lines changed

assets/themes/src/vscode/gruvbox/gruvbox-dark-hard.json

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,10 @@
423423
}
424424
},
425425
{
426-
"scope": ["string.interpolated.dollar.shell", "string.interpolated.backtick.shell"],
426+
"scope": [
427+
"string.interpolated.dollar.shell",
428+
"string.interpolated.backtick.shell"
429+
],
427430
"settings": {
428431
"foreground": "#8ec07c"
429432
}
@@ -489,13 +492,19 @@
489492

490493
{
491494
"name": "coloring of the Java import and package identifiers",
492-
"scope": ["storage.modifier.import.java", "storage.modifier.package.java"],
495+
"scope": [
496+
"storage.modifier.import.java",
497+
"storage.modifier.package.java"
498+
],
493499
"settings": {
494500
"foreground": "#bdae93"
495501
}
496502
},
497503
{
498-
"scope": ["keyword.other.import.java", "keyword.other.package.java"],
504+
"scope": [
505+
"keyword.other.import.java",
506+
"keyword.other.package.java"
507+
],
499508
"settings": {
500509
"foreground": "#8ec07c"
501510
}
@@ -628,7 +637,9 @@
628637
},
629638
{
630639
"name": "JSON Level 0",
631-
"scope": ["source.json meta.structure.dictionary.json support.type.property-name.json"],
640+
"scope": [
641+
"source.json meta.structure.dictionary.json support.type.property-name.json"
642+
],
632643
"settings": {
633644
"foreground": "#b8bb26"
634645
}
@@ -761,7 +772,10 @@
761772
}
762773
},
763774
{
764-
"scope": ["source.go keyword.interface", "source.go keyword.struct"],
775+
"scope": [
776+
"source.go keyword.interface",
777+
"source.go keyword.struct"
778+
],
765779
"settings": {
766780
"foreground": "#83a598"
767781
}
@@ -788,7 +802,10 @@
788802

789803
{
790804
"name": "ReasonML String",
791-
"scope": ["source.reason string.double", "source.reason string.regexp"],
805+
"scope": [
806+
"source.reason string.double",
807+
"source.reason string.regexp"
808+
],
792809
"settings": {
793810
"foreground": "#b8bb26"
794811
}
@@ -809,7 +826,10 @@
809826
},
810827
{
811828
"name": "ReasonML property",
812-
"scope": ["source.reason support.property-value", "source.reason entity.name.filename"],
829+
"scope": [
830+
"source.reason support.property-value",
831+
"source.reason entity.name.filename"
832+
],
813833
"settings": {
814834
"foreground": "#fe8019"
815835
}
@@ -831,7 +851,9 @@
831851
},
832852
{
833853
"name": "Powershell function attribute",
834-
"scope": ["source.powershell support.function.attribute.powershell"],
854+
"scope": [
855+
"source.powershell support.function.attribute.powershell"
856+
],
835857
"settings": {
836858
"foreground": "#bdae93"
837859
}

assets/themes/src/vscode/gruvbox/gruvbox-dark-medium.json

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,10 @@
423423
}
424424
},
425425
{
426-
"scope": ["string.interpolated.dollar.shell", "string.interpolated.backtick.shell"],
426+
"scope": [
427+
"string.interpolated.dollar.shell",
428+
"string.interpolated.backtick.shell"
429+
],
427430
"settings": {
428431
"foreground": "#8ec07c"
429432
}
@@ -489,13 +492,19 @@
489492

490493
{
491494
"name": "coloring of the Java import and package identifiers",
492-
"scope": ["storage.modifier.import.java", "storage.modifier.package.java"],
495+
"scope": [
496+
"storage.modifier.import.java",
497+
"storage.modifier.package.java"
498+
],
493499
"settings": {
494500
"foreground": "#bdae93"
495501
}
496502
},
497503
{
498-
"scope": ["keyword.other.import.java", "keyword.other.package.java"],
504+
"scope": [
505+
"keyword.other.import.java",
506+
"keyword.other.package.java"
507+
],
499508
"settings": {
500509
"foreground": "#8ec07c"
501510
}
@@ -628,7 +637,9 @@
628637
},
629638
{
630639
"name": "JSON Level 0",
631-
"scope": ["source.json meta.structure.dictionary.json support.type.property-name.json"],
640+
"scope": [
641+
"source.json meta.structure.dictionary.json support.type.property-name.json"
642+
],
632643
"settings": {
633644
"foreground": "#b8bb26"
634645
}
@@ -761,7 +772,10 @@
761772
}
762773
},
763774
{
764-
"scope": ["source.go keyword.interface", "source.go keyword.struct"],
775+
"scope": [
776+
"source.go keyword.interface",
777+
"source.go keyword.struct"
778+
],
765779
"settings": {
766780
"foreground": "#83a598"
767781
}
@@ -788,7 +802,10 @@
788802

789803
{
790804
"name": "ReasonML String",
791-
"scope": ["source.reason string.double", "source.reason string.regexp"],
805+
"scope": [
806+
"source.reason string.double",
807+
"source.reason string.regexp"
808+
],
792809
"settings": {
793810
"foreground": "#b8bb26"
794811
}
@@ -809,7 +826,10 @@
809826
},
810827
{
811828
"name": "ReasonML property",
812-
"scope": ["source.reason support.property-value", "source.reason entity.name.filename"],
829+
"scope": [
830+
"source.reason support.property-value",
831+
"source.reason entity.name.filename"
832+
],
813833
"settings": {
814834
"foreground": "#fe8019"
815835
}
@@ -831,7 +851,9 @@
831851
},
832852
{
833853
"name": "Powershell function attribute",
834-
"scope": ["source.powershell support.function.attribute.powershell"],
854+
"scope": [
855+
"source.powershell support.function.attribute.powershell"
856+
],
835857
"settings": {
836858
"foreground": "#bdae93"
837859
}

assets/themes/src/vscode/gruvbox/gruvbox-dark-soft.json

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,10 @@
423423
}
424424
},
425425
{
426-
"scope": ["string.interpolated.dollar.shell", "string.interpolated.backtick.shell"],
426+
"scope": [
427+
"string.interpolated.dollar.shell",
428+
"string.interpolated.backtick.shell"
429+
],
427430
"settings": {
428431
"foreground": "#8ec07c"
429432
}
@@ -489,13 +492,19 @@
489492

490493
{
491494
"name": "coloring of the Java import and package identifiers",
492-
"scope": ["storage.modifier.import.java", "storage.modifier.package.java"],
495+
"scope": [
496+
"storage.modifier.import.java",
497+
"storage.modifier.package.java"
498+
],
493499
"settings": {
494500
"foreground": "#bdae93"
495501
}
496502
},
497503
{
498-
"scope": ["keyword.other.import.java", "keyword.other.package.java"],
504+
"scope": [
505+
"keyword.other.import.java",
506+
"keyword.other.package.java"
507+
],
499508
"settings": {
500509
"foreground": "#8ec07c"
501510
}
@@ -628,7 +637,9 @@
628637
},
629638
{
630639
"name": "JSON Level 0",
631-
"scope": ["source.json meta.structure.dictionary.json support.type.property-name.json"],
640+
"scope": [
641+
"source.json meta.structure.dictionary.json support.type.property-name.json"
642+
],
632643
"settings": {
633644
"foreground": "#b8bb26"
634645
}
@@ -761,7 +772,10 @@
761772
}
762773
},
763774
{
764-
"scope": ["source.go keyword.interface", "source.go keyword.struct"],
775+
"scope": [
776+
"source.go keyword.interface",
777+
"source.go keyword.struct"
778+
],
765779
"settings": {
766780
"foreground": "#83a598"
767781
}
@@ -788,7 +802,10 @@
788802

789803
{
790804
"name": "ReasonML String",
791-
"scope": ["source.reason string.double", "source.reason string.regexp"],
805+
"scope": [
806+
"source.reason string.double",
807+
"source.reason string.regexp"
808+
],
792809
"settings": {
793810
"foreground": "#b8bb26"
794811
}
@@ -809,7 +826,10 @@
809826
},
810827
{
811828
"name": "ReasonML property",
812-
"scope": ["source.reason support.property-value", "source.reason entity.name.filename"],
829+
"scope": [
830+
"source.reason support.property-value",
831+
"source.reason entity.name.filename"
832+
],
813833
"settings": {
814834
"foreground": "#fe8019"
815835
}
@@ -831,7 +851,9 @@
831851
},
832852
{
833853
"name": "Powershell function attribute",
834-
"scope": ["source.powershell support.function.attribute.powershell"],
854+
"scope": [
855+
"source.powershell support.function.attribute.powershell"
856+
],
835857
"settings": {
836858
"foreground": "#bdae93"
837859
}

assets/themes/src/vscode/gruvbox/gruvbox-light-hard.json

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,10 @@
422422
}
423423
},
424424
{
425-
"scope": ["string.interpolated.dollar.shell", "string.interpolated.backtick.shell"],
425+
"scope": [
426+
"string.interpolated.dollar.shell",
427+
"string.interpolated.backtick.shell"
428+
],
426429
"settings": {
427430
"foreground": "#427b58"
428431
}
@@ -488,13 +491,19 @@
488491

489492
{
490493
"name": "coloring of the Java import and package identifiers",
491-
"scope": ["storage.modifier.import.java", "storage.modifier.package.java"],
494+
"scope": [
495+
"storage.modifier.import.java",
496+
"storage.modifier.package.java"
497+
],
492498
"settings": {
493499
"foreground": "#665c54"
494500
}
495501
},
496502
{
497-
"scope": ["keyword.other.import.java", "keyword.other.package.java"],
503+
"scope": [
504+
"keyword.other.import.java",
505+
"keyword.other.package.java"
506+
],
498507
"settings": {
499508
"foreground": "#427b58"
500509
}
@@ -627,7 +636,9 @@
627636
},
628637
{
629638
"name": "JSON Level 0",
630-
"scope": ["source.json meta.structure.dictionary.json support.type.property-name.json"],
639+
"scope": [
640+
"source.json meta.structure.dictionary.json support.type.property-name.json"
641+
],
631642
"settings": {
632643
"foreground": "#79740e"
633644
}
@@ -760,7 +771,10 @@
760771
}
761772
},
762773
{
763-
"scope": ["source.go keyword.interface", "source.go keyword.struct"],
774+
"scope": [
775+
"source.go keyword.interface",
776+
"source.go keyword.struct"
777+
],
764778
"settings": {
765779
"foreground": "#076678"
766780
}
@@ -787,7 +801,10 @@
787801

788802
{
789803
"name": "ReasonML String",
790-
"scope": ["source.reason string.double", "source.reason string.regexp"],
804+
"scope": [
805+
"source.reason string.double",
806+
"source.reason string.regexp"
807+
],
791808
"settings": {
792809
"foreground": "#79740e"
793810
}
@@ -808,7 +825,10 @@
808825
},
809826
{
810827
"name": "ReasonML property",
811-
"scope": ["source.reason support.property-value", "source.reason entity.name.filename"],
828+
"scope": [
829+
"source.reason support.property-value",
830+
"source.reason entity.name.filename"
831+
],
812832
"settings": {
813833
"foreground": "#af3a03"
814834
}
@@ -830,7 +850,9 @@
830850
},
831851
{
832852
"name": "Powershell function attribute",
833-
"scope": ["source.powershell support.function.attribute.powershell"],
853+
"scope": [
854+
"source.powershell support.function.attribute.powershell"
855+
],
834856
"settings": {
835857
"foreground": "#665c54"
836858
}

0 commit comments

Comments
 (0)