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
This commit is contained in:
Nate Butler 2023-11-09 17:40:10 -05:00 committed by GitHub
commit 2347576fb5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 4127 additions and 948 deletions

View file

@ -423,7 +423,10 @@
}
},
{
"scope": ["string.interpolated.dollar.shell", "string.interpolated.backtick.shell"],
"scope": [
"string.interpolated.dollar.shell",
"string.interpolated.backtick.shell"
],
"settings": {
"foreground": "#8ec07c"
}
@ -489,13 +492,19 @@
{
"name": "coloring of the Java import and package identifiers",
"scope": ["storage.modifier.import.java", "storage.modifier.package.java"],
"scope": [
"storage.modifier.import.java",
"storage.modifier.package.java"
],
"settings": {
"foreground": "#bdae93"
}
},
{
"scope": ["keyword.other.import.java", "keyword.other.package.java"],
"scope": [
"keyword.other.import.java",
"keyword.other.package.java"
],
"settings": {
"foreground": "#8ec07c"
}
@ -628,7 +637,9 @@
},
{
"name": "JSON Level 0",
"scope": ["source.json meta.structure.dictionary.json support.type.property-name.json"],
"scope": [
"source.json meta.structure.dictionary.json support.type.property-name.json"
],
"settings": {
"foreground": "#b8bb26"
}
@ -761,7 +772,10 @@
}
},
{
"scope": ["source.go keyword.interface", "source.go keyword.struct"],
"scope": [
"source.go keyword.interface",
"source.go keyword.struct"
],
"settings": {
"foreground": "#83a598"
}
@ -788,7 +802,10 @@
{
"name": "ReasonML String",
"scope": ["source.reason string.double", "source.reason string.regexp"],
"scope": [
"source.reason string.double",
"source.reason string.regexp"
],
"settings": {
"foreground": "#b8bb26"
}
@ -809,7 +826,10 @@
},
{
"name": "ReasonML property",
"scope": ["source.reason support.property-value", "source.reason entity.name.filename"],
"scope": [
"source.reason support.property-value",
"source.reason entity.name.filename"
],
"settings": {
"foreground": "#fe8019"
}
@ -831,7 +851,9 @@
},
{
"name": "Powershell function attribute",
"scope": ["source.powershell support.function.attribute.powershell"],
"scope": [
"source.powershell support.function.attribute.powershell"
],
"settings": {
"foreground": "#bdae93"
}

View file

@ -423,7 +423,10 @@
}
},
{
"scope": ["string.interpolated.dollar.shell", "string.interpolated.backtick.shell"],
"scope": [
"string.interpolated.dollar.shell",
"string.interpolated.backtick.shell"
],
"settings": {
"foreground": "#8ec07c"
}
@ -489,13 +492,19 @@
{
"name": "coloring of the Java import and package identifiers",
"scope": ["storage.modifier.import.java", "storage.modifier.package.java"],
"scope": [
"storage.modifier.import.java",
"storage.modifier.package.java"
],
"settings": {
"foreground": "#bdae93"
}
},
{
"scope": ["keyword.other.import.java", "keyword.other.package.java"],
"scope": [
"keyword.other.import.java",
"keyword.other.package.java"
],
"settings": {
"foreground": "#8ec07c"
}
@ -628,7 +637,9 @@
},
{
"name": "JSON Level 0",
"scope": ["source.json meta.structure.dictionary.json support.type.property-name.json"],
"scope": [
"source.json meta.structure.dictionary.json support.type.property-name.json"
],
"settings": {
"foreground": "#b8bb26"
}
@ -761,7 +772,10 @@
}
},
{
"scope": ["source.go keyword.interface", "source.go keyword.struct"],
"scope": [
"source.go keyword.interface",
"source.go keyword.struct"
],
"settings": {
"foreground": "#83a598"
}
@ -788,7 +802,10 @@
{
"name": "ReasonML String",
"scope": ["source.reason string.double", "source.reason string.regexp"],
"scope": [
"source.reason string.double",
"source.reason string.regexp"
],
"settings": {
"foreground": "#b8bb26"
}
@ -809,7 +826,10 @@
},
{
"name": "ReasonML property",
"scope": ["source.reason support.property-value", "source.reason entity.name.filename"],
"scope": [
"source.reason support.property-value",
"source.reason entity.name.filename"
],
"settings": {
"foreground": "#fe8019"
}
@ -831,7 +851,9 @@
},
{
"name": "Powershell function attribute",
"scope": ["source.powershell support.function.attribute.powershell"],
"scope": [
"source.powershell support.function.attribute.powershell"
],
"settings": {
"foreground": "#bdae93"
}

View file

@ -423,7 +423,10 @@
}
},
{
"scope": ["string.interpolated.dollar.shell", "string.interpolated.backtick.shell"],
"scope": [
"string.interpolated.dollar.shell",
"string.interpolated.backtick.shell"
],
"settings": {
"foreground": "#8ec07c"
}
@ -489,13 +492,19 @@
{
"name": "coloring of the Java import and package identifiers",
"scope": ["storage.modifier.import.java", "storage.modifier.package.java"],
"scope": [
"storage.modifier.import.java",
"storage.modifier.package.java"
],
"settings": {
"foreground": "#bdae93"
}
},
{
"scope": ["keyword.other.import.java", "keyword.other.package.java"],
"scope": [
"keyword.other.import.java",
"keyword.other.package.java"
],
"settings": {
"foreground": "#8ec07c"
}
@ -628,7 +637,9 @@
},
{
"name": "JSON Level 0",
"scope": ["source.json meta.structure.dictionary.json support.type.property-name.json"],
"scope": [
"source.json meta.structure.dictionary.json support.type.property-name.json"
],
"settings": {
"foreground": "#b8bb26"
}
@ -761,7 +772,10 @@
}
},
{
"scope": ["source.go keyword.interface", "source.go keyword.struct"],
"scope": [
"source.go keyword.interface",
"source.go keyword.struct"
],
"settings": {
"foreground": "#83a598"
}
@ -788,7 +802,10 @@
{
"name": "ReasonML String",
"scope": ["source.reason string.double", "source.reason string.regexp"],
"scope": [
"source.reason string.double",
"source.reason string.regexp"
],
"settings": {
"foreground": "#b8bb26"
}
@ -809,7 +826,10 @@
},
{
"name": "ReasonML property",
"scope": ["source.reason support.property-value", "source.reason entity.name.filename"],
"scope": [
"source.reason support.property-value",
"source.reason entity.name.filename"
],
"settings": {
"foreground": "#fe8019"
}
@ -831,7 +851,9 @@
},
{
"name": "Powershell function attribute",
"scope": ["source.powershell support.function.attribute.powershell"],
"scope": [
"source.powershell support.function.attribute.powershell"
],
"settings": {
"foreground": "#bdae93"
}

View file

@ -422,7 +422,10 @@
}
},
{
"scope": ["string.interpolated.dollar.shell", "string.interpolated.backtick.shell"],
"scope": [
"string.interpolated.dollar.shell",
"string.interpolated.backtick.shell"
],
"settings": {
"foreground": "#427b58"
}
@ -488,13 +491,19 @@
{
"name": "coloring of the Java import and package identifiers",
"scope": ["storage.modifier.import.java", "storage.modifier.package.java"],
"scope": [
"storage.modifier.import.java",
"storage.modifier.package.java"
],
"settings": {
"foreground": "#665c54"
}
},
{
"scope": ["keyword.other.import.java", "keyword.other.package.java"],
"scope": [
"keyword.other.import.java",
"keyword.other.package.java"
],
"settings": {
"foreground": "#427b58"
}
@ -627,7 +636,9 @@
},
{
"name": "JSON Level 0",
"scope": ["source.json meta.structure.dictionary.json support.type.property-name.json"],
"scope": [
"source.json meta.structure.dictionary.json support.type.property-name.json"
],
"settings": {
"foreground": "#79740e"
}
@ -760,7 +771,10 @@
}
},
{
"scope": ["source.go keyword.interface", "source.go keyword.struct"],
"scope": [
"source.go keyword.interface",
"source.go keyword.struct"
],
"settings": {
"foreground": "#076678"
}
@ -787,7 +801,10 @@
{
"name": "ReasonML String",
"scope": ["source.reason string.double", "source.reason string.regexp"],
"scope": [
"source.reason string.double",
"source.reason string.regexp"
],
"settings": {
"foreground": "#79740e"
}
@ -808,7 +825,10 @@
},
{
"name": "ReasonML property",
"scope": ["source.reason support.property-value", "source.reason entity.name.filename"],
"scope": [
"source.reason support.property-value",
"source.reason entity.name.filename"
],
"settings": {
"foreground": "#af3a03"
}
@ -830,7 +850,9 @@
},
{
"name": "Powershell function attribute",
"scope": ["source.powershell support.function.attribute.powershell"],
"scope": [
"source.powershell support.function.attribute.powershell"
],
"settings": {
"foreground": "#665c54"
}

View file

@ -422,7 +422,10 @@
}
},
{
"scope": ["string.interpolated.dollar.shell", "string.interpolated.backtick.shell"],
"scope": [
"string.interpolated.dollar.shell",
"string.interpolated.backtick.shell"
],
"settings": {
"foreground": "#427b58"
}
@ -488,13 +491,19 @@
{
"name": "coloring of the Java import and package identifiers",
"scope": ["storage.modifier.import.java", "storage.modifier.package.java"],
"scope": [
"storage.modifier.import.java",
"storage.modifier.package.java"
],
"settings": {
"foreground": "#665c54"
}
},
{
"scope": ["keyword.other.import.java", "keyword.other.package.java"],
"scope": [
"keyword.other.import.java",
"keyword.other.package.java"
],
"settings": {
"foreground": "#427b58"
}
@ -627,7 +636,9 @@
},
{
"name": "JSON Level 0",
"scope": ["source.json meta.structure.dictionary.json support.type.property-name.json"],
"scope": [
"source.json meta.structure.dictionary.json support.type.property-name.json"
],
"settings": {
"foreground": "#79740e"
}
@ -760,7 +771,10 @@
}
},
{
"scope": ["source.go keyword.interface", "source.go keyword.struct"],
"scope": [
"source.go keyword.interface",
"source.go keyword.struct"
],
"settings": {
"foreground": "#076678"
}
@ -787,7 +801,10 @@
{
"name": "ReasonML String",
"scope": ["source.reason string.double", "source.reason string.regexp"],
"scope": [
"source.reason string.double",
"source.reason string.regexp"
],
"settings": {
"foreground": "#79740e"
}
@ -808,7 +825,10 @@
},
{
"name": "ReasonML property",
"scope": ["source.reason support.property-value", "source.reason entity.name.filename"],
"scope": [
"source.reason support.property-value",
"source.reason entity.name.filename"
],
"settings": {
"foreground": "#af3a03"
}
@ -830,7 +850,9 @@
},
{
"name": "Powershell function attribute",
"scope": ["source.powershell support.function.attribute.powershell"],
"scope": [
"source.powershell support.function.attribute.powershell"
],
"settings": {
"foreground": "#665c54"
}

View file

@ -422,7 +422,10 @@
}
},
{
"scope": ["string.interpolated.dollar.shell", "string.interpolated.backtick.shell"],
"scope": [
"string.interpolated.dollar.shell",
"string.interpolated.backtick.shell"
],
"settings": {
"foreground": "#427b58"
}
@ -488,13 +491,19 @@
{
"name": "coloring of the Java import and package identifiers",
"scope": ["storage.modifier.import.java", "storage.modifier.package.java"],
"scope": [
"storage.modifier.import.java",
"storage.modifier.package.java"
],
"settings": {
"foreground": "#665c54"
}
},
{
"scope": ["keyword.other.import.java", "keyword.other.package.java"],
"scope": [
"keyword.other.import.java",
"keyword.other.package.java"
],
"settings": {
"foreground": "#427b58"
}
@ -627,7 +636,9 @@
},
{
"name": "JSON Level 0",
"scope": ["source.json meta.structure.dictionary.json support.type.property-name.json"],
"scope": [
"source.json meta.structure.dictionary.json support.type.property-name.json"
],
"settings": {
"foreground": "#79740e"
}
@ -760,7 +771,10 @@
}
},
{
"scope": ["source.go keyword.interface", "source.go keyword.struct"],
"scope": [
"source.go keyword.interface",
"source.go keyword.struct"
],
"settings": {
"foreground": "#076678"
}
@ -787,7 +801,10 @@
{
"name": "ReasonML String",
"scope": ["source.reason string.double", "source.reason string.regexp"],
"scope": [
"source.reason string.double",
"source.reason string.regexp"
],
"settings": {
"foreground": "#79740e"
}
@ -808,7 +825,10 @@
},
{
"name": "ReasonML property",
"scope": ["source.reason support.property-value", "source.reason entity.name.filename"],
"scope": [
"source.reason support.property-value",
"source.reason entity.name.filename"
],
"settings": {
"foreground": "#af3a03"
}
@ -830,7 +850,9 @@
},
{
"name": "Powershell function attribute",
"scope": ["source.powershell support.function.attribute.powershell"],
"scope": [
"source.powershell support.function.attribute.powershell"
],
"settings": {
"foreground": "#665c54"
}

View file

@ -1,21 +1,21 @@
{
"name": "Rose Pine",
"author": "Rosé Pine",
"themes": [
{
"name": "Rose Pine",
"file_name": "rose-pine.json",
"appearance": "dark"
},
{
"name": "Rose Moon",
"file_name": "rose-pine-moon.json",
"appearance": "dark"
},
{
"name": "Rose Pine Dawn",
"file_name": "rose-pine-dawn.json",
"appearance": "light"
}
]
"name": "Rose Pine",
"author": "Rosé Pine",
"themes": [
{
"name": "Rose Pine",
"file_name": "rose-pine.json",
"appearance": "dark"
},
{
"name": "Rose Pine Moon",
"file_name": "rose-pine-moon.json",
"appearance": "dark"
},
{
"name": "Rose Pine Dawn",
"file_name": "rose-pine-dawn.json",
"appearance": "light"
}
]
}

File diff suppressed because it is too large Load diff