From 63ce7cd407ca97685fb47ebbdce403dceecf0dfb Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Fri, 8 Dec 2023 11:17:05 -0500 Subject: [PATCH] Improve matching for preprocessor tokens --- crates/theme2/src/themes/gruvbox.rs | 42 ++++++++++++ crates/theme2/src/themes/noctis.rs | 77 ++++++++++++++++++++++ crates/theme2/src/themes/nord.rs | 7 ++ crates/theme2/src/themes/solarized.rs | 14 ++++ crates/theme_importer/src/vscode/syntax.rs | 6 +- 5 files changed, 145 insertions(+), 1 deletion(-) diff --git a/crates/theme2/src/themes/gruvbox.rs b/crates/theme2/src/themes/gruvbox.rs index 1ada65400f..5674593c2d 100644 --- a/crates/theme2/src/themes/gruvbox.rs +++ b/crates/theme2/src/themes/gruvbox.rs @@ -141,6 +141,13 @@ pub fn gruvbox() -> UserThemeFamily { ..Default::default() }, ), + ( + "preproc".into(), + UserHighlightStyle { + color: Some(rgba(0xfe8019ff).into()), + ..Default::default() + }, + ), ( "property".into(), UserHighlightStyle { @@ -391,6 +398,13 @@ pub fn gruvbox() -> UserThemeFamily { ..Default::default() }, ), + ( + "preproc".into(), + UserHighlightStyle { + color: Some(rgba(0xfe8019ff).into()), + ..Default::default() + }, + ), ( "property".into(), UserHighlightStyle { @@ -641,6 +655,13 @@ pub fn gruvbox() -> UserThemeFamily { ..Default::default() }, ), + ( + "preproc".into(), + UserHighlightStyle { + color: Some(rgba(0xfe8019ff).into()), + ..Default::default() + }, + ), ( "property".into(), UserHighlightStyle { @@ -891,6 +912,13 @@ pub fn gruvbox() -> UserThemeFamily { ..Default::default() }, ), + ( + "preproc".into(), + UserHighlightStyle { + color: Some(rgba(0xaf3a03ff).into()), + ..Default::default() + }, + ), ( "property".into(), UserHighlightStyle { @@ -1141,6 +1169,13 @@ pub fn gruvbox() -> UserThemeFamily { ..Default::default() }, ), + ( + "preproc".into(), + UserHighlightStyle { + color: Some(rgba(0xaf3a03ff).into()), + ..Default::default() + }, + ), ( "property".into(), UserHighlightStyle { @@ -1391,6 +1426,13 @@ pub fn gruvbox() -> UserThemeFamily { ..Default::default() }, ), + ( + "preproc".into(), + UserHighlightStyle { + color: Some(rgba(0xaf3a03ff).into()), + ..Default::default() + }, + ), ( "property".into(), UserHighlightStyle { diff --git a/crates/theme2/src/themes/noctis.rs b/crates/theme2/src/themes/noctis.rs index caba6947fe..e09efd98c6 100644 --- a/crates/theme2/src/themes/noctis.rs +++ b/crates/theme2/src/themes/noctis.rs @@ -143,6 +143,13 @@ pub fn noctis() -> UserThemeFamily { ..Default::default() }, ), + ( + "preproc".into(), + UserHighlightStyle { + color: Some(rgba(0xdf769bff).into()), + ..Default::default() + }, + ), ( "property".into(), UserHighlightStyle { @@ -395,6 +402,13 @@ pub fn noctis() -> UserThemeFamily { ..Default::default() }, ), + ( + "preproc".into(), + UserHighlightStyle { + color: Some(rgba(0xdf769bff).into()), + ..Default::default() + }, + ), ( "property".into(), UserHighlightStyle { @@ -647,6 +661,13 @@ pub fn noctis() -> UserThemeFamily { ..Default::default() }, ), + ( + "preproc".into(), + UserHighlightStyle { + color: Some(rgba(0xff5792ff).into()), + ..Default::default() + }, + ), ( "property".into(), UserHighlightStyle { @@ -899,6 +920,13 @@ pub fn noctis() -> UserThemeFamily { ..Default::default() }, ), + ( + "preproc".into(), + UserHighlightStyle { + color: Some(rgba(0xff5792ff).into()), + ..Default::default() + }, + ), ( "property".into(), UserHighlightStyle { @@ -1151,6 +1179,13 @@ pub fn noctis() -> UserThemeFamily { ..Default::default() }, ), + ( + "preproc".into(), + UserHighlightStyle { + color: Some(rgba(0xff5792ff).into()), + ..Default::default() + }, + ), ( "property".into(), UserHighlightStyle { @@ -1403,6 +1438,13 @@ pub fn noctis() -> UserThemeFamily { ..Default::default() }, ), + ( + "preproc".into(), + UserHighlightStyle { + color: Some(rgba(0xc88da2ff).into()), + ..Default::default() + }, + ), ( "property".into(), UserHighlightStyle { @@ -1655,6 +1697,13 @@ pub fn noctis() -> UserThemeFamily { ..Default::default() }, ), + ( + "preproc".into(), + UserHighlightStyle { + color: Some(rgba(0xdf769bff).into()), + ..Default::default() + }, + ), ( "property".into(), UserHighlightStyle { @@ -1907,6 +1956,13 @@ pub fn noctis() -> UserThemeFamily { ..Default::default() }, ), + ( + "preproc".into(), + UserHighlightStyle { + color: Some(rgba(0xdf769bff).into()), + ..Default::default() + }, + ), ( "property".into(), UserHighlightStyle { @@ -2159,6 +2215,13 @@ pub fn noctis() -> UserThemeFamily { ..Default::default() }, ), + ( + "preproc".into(), + UserHighlightStyle { + color: Some(rgba(0xdf769bff).into()), + ..Default::default() + }, + ), ( "property".into(), UserHighlightStyle { @@ -2411,6 +2474,13 @@ pub fn noctis() -> UserThemeFamily { ..Default::default() }, ), + ( + "preproc".into(), + UserHighlightStyle { + color: Some(rgba(0xdf769bff).into()), + ..Default::default() + }, + ), ( "property".into(), UserHighlightStyle { @@ -2663,6 +2733,13 @@ pub fn noctis() -> UserThemeFamily { ..Default::default() }, ), + ( + "preproc".into(), + UserHighlightStyle { + color: Some(rgba(0xdf769bff).into()), + ..Default::default() + }, + ), ( "property".into(), UserHighlightStyle { diff --git a/crates/theme2/src/themes/nord.rs b/crates/theme2/src/themes/nord.rs index da03c82878..4206598086 100644 --- a/crates/theme2/src/themes/nord.rs +++ b/crates/theme2/src/themes/nord.rs @@ -135,6 +135,13 @@ pub fn nord() -> UserThemeFamily { ..Default::default() }, ), + ( + "preproc".into(), + UserHighlightStyle { + color: Some(rgba(0x5e81acff).into()), + ..Default::default() + }, + ), ( "punctuation".into(), UserHighlightStyle { diff --git a/crates/theme2/src/themes/solarized.rs b/crates/theme2/src/themes/solarized.rs index 7cec48b1f4..5d43b5704a 100644 --- a/crates/theme2/src/themes/solarized.rs +++ b/crates/theme2/src/themes/solarized.rs @@ -145,6 +145,13 @@ pub fn solarized() -> UserThemeFamily { ..Default::default() }, ), + ( + "preproc".into(), + UserHighlightStyle { + color: Some(rgba(0xb58900ff).into()), + ..Default::default() + }, + ), ( "property".into(), UserHighlightStyle { @@ -389,6 +396,13 @@ pub fn solarized() -> UserThemeFamily { ..Default::default() }, ), + ( + "preproc".into(), + UserHighlightStyle { + color: Some(rgba(0xb58900ff).into()), + ..Default::default() + }, + ), ( "punctuation.bracket".into(), UserHighlightStyle { diff --git a/crates/theme_importer/src/vscode/syntax.rs b/crates/theme_importer/src/vscode/syntax.rs index d5097639cb..990355065f 100644 --- a/crates/theme_importer/src/vscode/syntax.rs +++ b/crates/theme_importer/src/vscode/syntax.rs @@ -219,7 +219,11 @@ impl ZedSyntaxToken { ZedSyntaxToken::Number => vec!["constant.numeric", "number"], ZedSyntaxToken::Operator => vec!["operator", "keyword.operator"], ZedSyntaxToken::Predictive => vec![], - ZedSyntaxToken::Preproc => vec!["preproc"], + ZedSyntaxToken::Preproc => vec![ + "preproc", + "meta.preprocessor", + "punctuation.definition.preprocessor", + ], ZedSyntaxToken::Primary => vec![], ZedSyntaxToken::Property => vec![ "variable.member",