From f272881a6b69efa7295aa85990c91af1f92c4cf3 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Thu, 7 Dec 2023 22:11:31 -0500 Subject: [PATCH] theme_importer: Improve syntax token matching (#3549) This PR improves the approach we use to match syntax tokens between Zed and VS Code in the `theme_importer`. We now use the list of scopes assigned to each Zed syntax token to rank the possible candidates in the VS Code and then pick the candidate with the highest rank. So far this has proved to provide better colors across the board, but we'll continue to refine the matching over time. Release Notes: - N/A --- crates/theme2/src/themes/andromeda.rs | 36 +- crates/theme2/src/themes/ayu.rs | 48 ++- crates/theme2/src/themes/dracula.rs | 10 +- crates/theme2/src/themes/gruvbox.rs | 72 +++- crates/theme2/src/themes/night_owl.rs | 30 +- crates/theme2/src/themes/noctis.rs | 374 ++++++------------ crates/theme2/src/themes/nord.rs | 12 +- crates/theme2/src/themes/palenight.rs | 36 +- crates/theme2/src/themes/rose_pine.rs | 48 ++- crates/theme2/src/themes/solarized.rs | 30 +- crates/theme2/src/themes/synthwave_84.rs | 11 +- crates/theme_importer/src/main.rs | 30 +- crates/theme_importer/src/vscode/converter.rs | 31 +- crates/theme_importer/src/vscode/syntax.rs | 91 ++++- 14 files changed, 487 insertions(+), 372 deletions(-) diff --git a/crates/theme2/src/themes/andromeda.rs b/crates/theme2/src/themes/andromeda.rs index fb606c1650798ebdd3a2dafaec324014edcafd11..8dfc32d8b5fba7f2b625afd3970edb9e7892e10f 100644 --- a/crates/theme2/src/themes/andromeda.rs +++ b/crates/theme2/src/themes/andromeda.rs @@ -66,7 +66,7 @@ pub fn andromeda() -> UserThemeFamily { ( "attribute".into(), UserHighlightStyle { - color: Some(rgba(0xf39c12ff).into()), + color: Some(rgba(0xffe66dff).into()), ..Default::default() }, ), @@ -77,6 +77,13 @@ pub fn andromeda() -> UserThemeFamily { ..Default::default() }, ), + ( + "comment.doc".into(), + UserHighlightStyle { + color: Some(rgba(0xa0a1a7cc).into()), + ..Default::default() + }, + ), ( "emphasis".into(), UserHighlightStyle { @@ -143,7 +150,7 @@ pub fn andromeda() -> UserThemeFamily { ( "type".into(), UserHighlightStyle { - color: Some(rgba(0xffe66dff).into()), + color: Some(rgba(0xee5d43ff).into()), ..Default::default() }, ), @@ -154,6 +161,13 @@ pub fn andromeda() -> UserThemeFamily { ..Default::default() }, ), + ( + "variable.special".into(), + UserHighlightStyle { + color: Some(rgba(0x00e8c6ff).into()), + ..Default::default() + }, + ), ], }), }, @@ -210,7 +224,7 @@ pub fn andromeda() -> UserThemeFamily { ( "attribute".into(), UserHighlightStyle { - color: Some(rgba(0xf39c12ff).into()), + color: Some(rgba(0xffe66dff).into()), ..Default::default() }, ), @@ -221,6 +235,13 @@ pub fn andromeda() -> UserThemeFamily { ..Default::default() }, ), + ( + "comment.doc".into(), + UserHighlightStyle { + color: Some(rgba(0xa0a1a7cc).into()), + ..Default::default() + }, + ), ( "emphasis".into(), UserHighlightStyle { @@ -287,7 +308,7 @@ pub fn andromeda() -> UserThemeFamily { ( "type".into(), UserHighlightStyle { - color: Some(rgba(0xffe66dff).into()), + color: Some(rgba(0xee5d43ff).into()), ..Default::default() }, ), @@ -298,6 +319,13 @@ pub fn andromeda() -> UserThemeFamily { ..Default::default() }, ), + ( + "variable.special".into(), + UserHighlightStyle { + color: Some(rgba(0x00e8c6ff).into()), + ..Default::default() + }, + ), ], }), }, diff --git a/crates/theme2/src/themes/ayu.rs b/crates/theme2/src/themes/ayu.rs index 39ac2660e65d1f058a0d57517a22fb1c08e851e6..fe9d750461e81e038a9d647d8c1345e8544f0498 100644 --- a/crates/theme2/src/themes/ayu.rs +++ b/crates/theme2/src/themes/ayu.rs @@ -89,6 +89,14 @@ pub fn ayu() -> UserThemeFamily { ..Default::default() }, ), + ( + "comment.doc".into(), + UserHighlightStyle { + color: Some(rgba(0x787b8099).into()), + font_style: Some(UserFontStyle::Italic), + ..Default::default() + }, + ), ( "constant".into(), UserHighlightStyle { @@ -122,14 +130,14 @@ pub fn ayu() -> UserThemeFamily { ( "function".into(), UserHighlightStyle { - color: Some(rgba(0xf2ae49ff).into()), + color: Some(rgba(0xf07171ff).into()), ..Default::default() }, ), ( "keyword".into(), UserHighlightStyle { - color: Some(rgba(0xfa8d3eff).into()), + color: Some(rgba(0x55b4d4ff).into()), ..Default::default() }, ), @@ -171,7 +179,7 @@ pub fn ayu() -> UserThemeFamily { ( "property".into(), UserHighlightStyle { - color: Some(rgba(0xf07171ff).into()), + color: Some(rgba(0x55b4d4ff).into()), ..Default::default() }, ), @@ -269,7 +277,7 @@ pub fn ayu() -> UserThemeFamily { ( "variable.special".into(), UserHighlightStyle { - color: Some(rgba(0xf07171ff).into()), + color: Some(rgba(0xf2ae49ff).into()), ..Default::default() }, ), @@ -352,6 +360,14 @@ pub fn ayu() -> UserThemeFamily { ..Default::default() }, ), + ( + "comment.doc".into(), + UserHighlightStyle { + color: Some(rgba(0xb8cfe680).into()), + font_style: Some(UserFontStyle::Italic), + ..Default::default() + }, + ), ( "constant".into(), UserHighlightStyle { @@ -385,14 +401,14 @@ pub fn ayu() -> UserThemeFamily { ( "function".into(), UserHighlightStyle { - color: Some(rgba(0xffd173ff).into()), + color: Some(rgba(0xf28779ff).into()), ..Default::default() }, ), ( "keyword".into(), UserHighlightStyle { - color: Some(rgba(0xffad66ff).into()), + color: Some(rgba(0x5ccfe6ff).into()), ..Default::default() }, ), @@ -434,7 +450,7 @@ pub fn ayu() -> UserThemeFamily { ( "property".into(), UserHighlightStyle { - color: Some(rgba(0xf28779ff).into()), + color: Some(rgba(0x5ccfe6ff).into()), ..Default::default() }, ), @@ -532,7 +548,7 @@ pub fn ayu() -> UserThemeFamily { ( "variable.special".into(), UserHighlightStyle { - color: Some(rgba(0xf28779ff).into()), + color: Some(rgba(0xffd173ff).into()), ..Default::default() }, ), @@ -615,6 +631,14 @@ pub fn ayu() -> UserThemeFamily { ..Default::default() }, ), + ( + "comment.doc".into(), + UserHighlightStyle { + color: Some(rgba(0xacb6bf8c).into()), + font_style: Some(UserFontStyle::Italic), + ..Default::default() + }, + ), ( "constant".into(), UserHighlightStyle { @@ -648,14 +672,14 @@ pub fn ayu() -> UserThemeFamily { ( "function".into(), UserHighlightStyle { - color: Some(rgba(0xffb454ff).into()), + color: Some(rgba(0xf07178ff).into()), ..Default::default() }, ), ( "keyword".into(), UserHighlightStyle { - color: Some(rgba(0xff8f40ff).into()), + color: Some(rgba(0x39bae6ff).into()), ..Default::default() }, ), @@ -697,7 +721,7 @@ pub fn ayu() -> UserThemeFamily { ( "property".into(), UserHighlightStyle { - color: Some(rgba(0xf07178ff).into()), + color: Some(rgba(0x39bae6ff).into()), ..Default::default() }, ), @@ -795,7 +819,7 @@ pub fn ayu() -> UserThemeFamily { ( "variable.special".into(), UserHighlightStyle { - color: Some(rgba(0xf07178ff).into()), + color: Some(rgba(0xffb454ff).into()), ..Default::default() }, ), diff --git a/crates/theme2/src/themes/dracula.rs b/crates/theme2/src/themes/dracula.rs index 49caf3cff95318e7dcfc3d59449b9e45d12ee7f3..bf8fc12b8aaaca4a5c34f65f2158fcfbb76bbb6a 100644 --- a/crates/theme2/src/themes/dracula.rs +++ b/crates/theme2/src/themes/dracula.rs @@ -83,6 +83,13 @@ pub fn dracula() -> UserThemeFamily { ..Default::default() }, ), + ( + "comment.doc".into(), + UserHighlightStyle { + color: Some(rgba(0x6272a4ff).into()), + ..Default::default() + }, + ), ( "emphasis".into(), UserHighlightStyle { @@ -159,8 +166,7 @@ pub fn dracula() -> UserThemeFamily { ( "variable".into(), UserHighlightStyle { - color: Some(rgba(0xbd93f9ff).into()), - font_style: Some(UserFontStyle::Italic), + color: Some(rgba(0xf8f8f2ff).into()), ..Default::default() }, ), diff --git a/crates/theme2/src/themes/gruvbox.rs b/crates/theme2/src/themes/gruvbox.rs index 7de52df753a1d306bd786bb652183ed244103e52..44d779071a22140f5f1788a4bda14c998d1bb273 100644 --- a/crates/theme2/src/themes/gruvbox.rs +++ b/crates/theme2/src/themes/gruvbox.rs @@ -82,8 +82,9 @@ pub fn gruvbox() -> UserThemeFamily { }, ), ( - "emphasis".into(), + "comment.doc".into(), UserHighlightStyle { + color: Some(rgba(0x928374ff).into()), font_style: Some(UserFontStyle::Italic), ..Default::default() }, @@ -148,7 +149,7 @@ pub fn gruvbox() -> UserThemeFamily { ( "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0xa89984ff).into()), + color: Some(rgba(0x83a598ff).into()), ..Default::default() }, ), @@ -201,6 +202,13 @@ pub fn gruvbox() -> UserThemeFamily { ..Default::default() }, ), + ( + "variable.special".into(), + UserHighlightStyle { + color: Some(rgba(0x83a598ff).into()), + ..Default::default() + }, + ), ], }), }, @@ -273,8 +281,9 @@ pub fn gruvbox() -> UserThemeFamily { }, ), ( - "emphasis".into(), + "comment.doc".into(), UserHighlightStyle { + color: Some(rgba(0x928374ff).into()), font_style: Some(UserFontStyle::Italic), ..Default::default() }, @@ -339,7 +348,7 @@ pub fn gruvbox() -> UserThemeFamily { ( "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0xa89984ff).into()), + color: Some(rgba(0x83a598ff).into()), ..Default::default() }, ), @@ -392,6 +401,13 @@ pub fn gruvbox() -> UserThemeFamily { ..Default::default() }, ), + ( + "variable.special".into(), + UserHighlightStyle { + color: Some(rgba(0x83a598ff).into()), + ..Default::default() + }, + ), ], }), }, @@ -464,8 +480,9 @@ pub fn gruvbox() -> UserThemeFamily { }, ), ( - "emphasis".into(), + "comment.doc".into(), UserHighlightStyle { + color: Some(rgba(0x928374ff).into()), font_style: Some(UserFontStyle::Italic), ..Default::default() }, @@ -530,7 +547,7 @@ pub fn gruvbox() -> UserThemeFamily { ( "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0xa89984ff).into()), + color: Some(rgba(0x83a598ff).into()), ..Default::default() }, ), @@ -583,6 +600,13 @@ pub fn gruvbox() -> UserThemeFamily { ..Default::default() }, ), + ( + "variable.special".into(), + UserHighlightStyle { + color: Some(rgba(0x83a598ff).into()), + ..Default::default() + }, + ), ], }), }, @@ -655,8 +679,9 @@ pub fn gruvbox() -> UserThemeFamily { }, ), ( - "emphasis".into(), + "comment.doc".into(), UserHighlightStyle { + color: Some(rgba(0x928374ff).into()), font_style: Some(UserFontStyle::Italic), ..Default::default() }, @@ -721,7 +746,7 @@ pub fn gruvbox() -> UserThemeFamily { ( "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x7c6f64ff).into()), + color: Some(rgba(0x076678ff).into()), ..Default::default() }, ), @@ -774,6 +799,13 @@ pub fn gruvbox() -> UserThemeFamily { ..Default::default() }, ), + ( + "variable.special".into(), + UserHighlightStyle { + color: Some(rgba(0x076678ff).into()), + ..Default::default() + }, + ), ], }), }, @@ -846,8 +878,9 @@ pub fn gruvbox() -> UserThemeFamily { }, ), ( - "emphasis".into(), + "comment.doc".into(), UserHighlightStyle { + color: Some(rgba(0x928374ff).into()), font_style: Some(UserFontStyle::Italic), ..Default::default() }, @@ -912,7 +945,7 @@ pub fn gruvbox() -> UserThemeFamily { ( "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x7c6f64ff).into()), + color: Some(rgba(0x076678ff).into()), ..Default::default() }, ), @@ -965,6 +998,13 @@ pub fn gruvbox() -> UserThemeFamily { ..Default::default() }, ), + ( + "variable.special".into(), + UserHighlightStyle { + color: Some(rgba(0x076678ff).into()), + ..Default::default() + }, + ), ], }), }, @@ -1037,8 +1077,9 @@ pub fn gruvbox() -> UserThemeFamily { }, ), ( - "emphasis".into(), + "comment.doc".into(), UserHighlightStyle { + color: Some(rgba(0x928374ff).into()), font_style: Some(UserFontStyle::Italic), ..Default::default() }, @@ -1103,7 +1144,7 @@ pub fn gruvbox() -> UserThemeFamily { ( "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x7c6f64ff).into()), + color: Some(rgba(0x076678ff).into()), ..Default::default() }, ), @@ -1156,6 +1197,13 @@ pub fn gruvbox() -> UserThemeFamily { ..Default::default() }, ), + ( + "variable.special".into(), + UserHighlightStyle { + color: Some(rgba(0x076678ff).into()), + ..Default::default() + }, + ), ], }), }, diff --git a/crates/theme2/src/themes/night_owl.rs b/crates/theme2/src/themes/night_owl.rs index ef9b8c59a089a35d1c5736b9ab57afc2ac017442..13a931453b882e3e095f0e985706f5978c58f520 100644 --- a/crates/theme2/src/themes/night_owl.rs +++ b/crates/theme2/src/themes/night_owl.rs @@ -90,6 +90,14 @@ pub fn night_owl() -> UserThemeFamily { ..Default::default() }, ), + ( + "comment.doc".into(), + UserHighlightStyle { + color: Some(rgba(0x637777ff).into()), + font_style: Some(UserFontStyle::Italic), + ..Default::default() + }, + ), ( "constant".into(), UserHighlightStyle { @@ -100,8 +108,7 @@ pub fn night_owl() -> UserThemeFamily { ( "function".into(), UserHighlightStyle { - color: Some(rgba(0xc792eaff).into()), - font_style: Some(UserFontStyle::Italic), + color: Some(rgba(0x82aaffff).into()), ..Default::default() }, ), @@ -137,8 +144,7 @@ pub fn night_owl() -> UserThemeFamily { ( "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0xc792eaff).into()), - font_style: Some(UserFontStyle::Italic), + color: Some(rgba(0x7fdbcaff).into()), ..Default::default() }, ), @@ -180,7 +186,7 @@ pub fn night_owl() -> UserThemeFamily { ( "variable".into(), UserHighlightStyle { - color: Some(rgba(0xc5e478ff).into()), + color: Some(rgba(0xd7dbe0ff).into()), ..Default::default() }, ), @@ -272,6 +278,14 @@ pub fn night_owl() -> UserThemeFamily { ..Default::default() }, ), + ( + "comment.doc".into(), + UserHighlightStyle { + color: Some(rgba(0x989fb1ff).into()), + font_style: Some(UserFontStyle::Italic), + ..Default::default() + }, + ), ( "constant".into(), UserHighlightStyle { @@ -282,8 +296,7 @@ pub fn night_owl() -> UserThemeFamily { ( "function".into(), UserHighlightStyle { - color: Some(rgba(0x994cc3ff).into()), - font_style: Some(UserFontStyle::Italic), + color: Some(rgba(0x4876d6ff).into()), ..Default::default() }, ), @@ -320,7 +333,6 @@ pub fn night_owl() -> UserThemeFamily { "punctuation".into(), UserHighlightStyle { color: Some(rgba(0x994cc3ff).into()), - font_style: Some(UserFontStyle::Italic), ..Default::default() }, ), @@ -362,7 +374,7 @@ pub fn night_owl() -> UserThemeFamily { ( "variable".into(), UserHighlightStyle { - color: Some(rgba(0x4876d6ff).into()), + color: Some(rgba(0x403f53ff).into()), ..Default::default() }, ), diff --git a/crates/theme2/src/themes/noctis.rs b/crates/theme2/src/themes/noctis.rs index 5598635ff2f2597e672233c84a97c472d5333bce..d19aeb61d3b41ac5089f951975335b8b8e79a272 100644 --- a/crates/theme2/src/themes/noctis.rs +++ b/crates/theme2/src/themes/noctis.rs @@ -84,23 +84,16 @@ pub fn noctis() -> UserThemeFamily { }, ), ( - "constant".into(), + "comment.doc".into(), UserHighlightStyle { - color: Some(rgba(0xbecfdaff).into()), - ..Default::default() - }, - ), - ( - "constructor".into(), - UserHighlightStyle { - font_weight: Some(UserFontWeight(700.0)), + color: Some(rgba(0x5988a6ff).into()), ..Default::default() }, ), ( - "emphasis".into(), + "constant".into(), UserHighlightStyle { - font_style: Some(UserFontStyle::Italic), + color: Some(rgba(0xbecfdaff).into()), ..Default::default() }, ), @@ -114,7 +107,7 @@ pub fn noctis() -> UserThemeFamily { ( "keyword".into(), UserHighlightStyle { - color: Some(rgba(0xdf769bff).into()), + color: Some(rgba(0xe66533ff).into()), ..Default::default() }, ), @@ -128,14 +121,14 @@ pub fn noctis() -> UserThemeFamily { ( "link_text".into(), UserHighlightStyle { - color: Some(rgba(0x16a3b6ff).into()), + color: Some(rgba(0x49d6e9ff).into()), ..Default::default() }, ), ( "link_uri".into(), UserHighlightStyle { - color: Some(rgba(0x16a3b6ff).into()), + color: Some(rgba(0x49d6e9ff).into()), ..Default::default() }, ), @@ -146,13 +139,6 @@ pub fn noctis() -> UserThemeFamily { ..Default::default() }, ), - ( - "operator".into(), - UserHighlightStyle { - font_weight: Some(UserFontWeight(700.0)), - ..Default::default() - }, - ), ( "property".into(), UserHighlightStyle { @@ -163,7 +149,7 @@ pub fn noctis() -> UserThemeFamily { ( "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x5988a6ff).into()), + color: Some(rgba(0xbecfdaff).into()), ..Default::default() }, ), @@ -191,7 +177,7 @@ pub fn noctis() -> UserThemeFamily { ( "tag".into(), UserHighlightStyle { - color: Some(rgba(0xdf769bff).into()), + color: Some(rgba(0xe66533ff).into()), ..Default::default() }, ), @@ -212,7 +198,7 @@ pub fn noctis() -> UserThemeFamily { ( "type".into(), UserHighlightStyle { - color: Some(rgba(0x49d6e9ff).into()), + color: Some(rgba(0xd67e5cff).into()), ..Default::default() }, ), @@ -304,23 +290,16 @@ pub fn noctis() -> UserThemeFamily { }, ), ( - "constant".into(), - UserHighlightStyle { - color: Some(rgba(0xcbbec2ff).into()), - ..Default::default() - }, - ), - ( - "constructor".into(), + "comment.doc".into(), UserHighlightStyle { - font_weight: Some(UserFontWeight(700.0)), + color: Some(rgba(0x8b747cff).into()), ..Default::default() }, ), ( - "emphasis".into(), + "constant".into(), UserHighlightStyle { - font_style: Some(UserFontStyle::Italic), + color: Some(rgba(0xcbbec2ff).into()), ..Default::default() }, ), @@ -334,7 +313,7 @@ pub fn noctis() -> UserThemeFamily { ( "keyword".into(), UserHighlightStyle { - color: Some(rgba(0xdf769bff).into()), + color: Some(rgba(0xe66533ff).into()), ..Default::default() }, ), @@ -348,14 +327,14 @@ pub fn noctis() -> UserThemeFamily { ( "link_text".into(), UserHighlightStyle { - color: Some(rgba(0x16a3b6ff).into()), + color: Some(rgba(0x49d6e9ff).into()), ..Default::default() }, ), ( "link_uri".into(), UserHighlightStyle { - color: Some(rgba(0x16a3b6ff).into()), + color: Some(rgba(0x49d6e9ff).into()), ..Default::default() }, ), @@ -366,13 +345,6 @@ pub fn noctis() -> UserThemeFamily { ..Default::default() }, ), - ( - "operator".into(), - UserHighlightStyle { - font_weight: Some(UserFontWeight(700.0)), - ..Default::default() - }, - ), ( "property".into(), UserHighlightStyle { @@ -383,7 +355,7 @@ pub fn noctis() -> UserThemeFamily { ( "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x8b747cff).into()), + color: Some(rgba(0xcbbec2ff).into()), ..Default::default() }, ), @@ -411,7 +383,7 @@ pub fn noctis() -> UserThemeFamily { ( "tag".into(), UserHighlightStyle { - color: Some(rgba(0xdf769bff).into()), + color: Some(rgba(0xe66533ff).into()), ..Default::default() }, ), @@ -432,7 +404,7 @@ pub fn noctis() -> UserThemeFamily { ( "type".into(), UserHighlightStyle { - color: Some(rgba(0x49d6e9ff).into()), + color: Some(rgba(0xd67e5cff).into()), ..Default::default() }, ), @@ -524,23 +496,16 @@ pub fn noctis() -> UserThemeFamily { }, ), ( - "constant".into(), + "comment.doc".into(), UserHighlightStyle { - color: Some(rgba(0x004d57ff).into()), - ..Default::default() - }, - ), - ( - "constructor".into(), - UserHighlightStyle { - font_weight: Some(UserFontWeight(700.0)), + color: Some(rgba(0x8ca6a6ff).into()), ..Default::default() }, ), ( - "emphasis".into(), + "constant".into(), UserHighlightStyle { - font_style: Some(UserFontStyle::Italic), + color: Some(rgba(0x004d57ff).into()), ..Default::default() }, ), @@ -554,7 +519,7 @@ pub fn noctis() -> UserThemeFamily { ( "keyword".into(), UserHighlightStyle { - color: Some(rgba(0xff5792ff).into()), + color: Some(rgba(0xe64100ff).into()), ..Default::default() }, ), @@ -568,14 +533,14 @@ pub fn noctis() -> UserThemeFamily { ( "link_text".into(), UserHighlightStyle { - color: Some(rgba(0x0095a8ff).into()), + color: Some(rgba(0x00bdd6ff).into()), ..Default::default() }, ), ( "link_uri".into(), UserHighlightStyle { - color: Some(rgba(0x0095a8ff).into()), + color: Some(rgba(0x00bdd6ff).into()), ..Default::default() }, ), @@ -586,13 +551,6 @@ pub fn noctis() -> UserThemeFamily { ..Default::default() }, ), - ( - "operator".into(), - UserHighlightStyle { - font_weight: Some(UserFontWeight(700.0)), - ..Default::default() - }, - ), ( "property".into(), UserHighlightStyle { @@ -603,7 +561,7 @@ pub fn noctis() -> UserThemeFamily { ( "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x8ca6a6ff).into()), + color: Some(rgba(0x004d57ff).into()), ..Default::default() }, ), @@ -631,7 +589,7 @@ pub fn noctis() -> UserThemeFamily { ( "tag".into(), UserHighlightStyle { - color: Some(rgba(0xff5792ff).into()), + color: Some(rgba(0xe64100ff).into()), ..Default::default() }, ), @@ -652,7 +610,7 @@ pub fn noctis() -> UserThemeFamily { ( "type".into(), UserHighlightStyle { - color: Some(rgba(0x00bdd6ff).into()), + color: Some(rgba(0xb3694dff).into()), ..Default::default() }, ), @@ -744,23 +702,16 @@ pub fn noctis() -> UserThemeFamily { }, ), ( - "constant".into(), + "comment.doc".into(), UserHighlightStyle { - color: Some(rgba(0x0c006bff).into()), - ..Default::default() - }, - ), - ( - "constructor".into(), - UserHighlightStyle { - font_weight: Some(UserFontWeight(700.0)), + color: Some(rgba(0x9995b7ff).into()), ..Default::default() }, ), ( - "emphasis".into(), + "constant".into(), UserHighlightStyle { - font_style: Some(UserFontStyle::Italic), + color: Some(rgba(0x0c006bff).into()), ..Default::default() }, ), @@ -774,7 +725,7 @@ pub fn noctis() -> UserThemeFamily { ( "keyword".into(), UserHighlightStyle { - color: Some(rgba(0xff5792ff).into()), + color: Some(rgba(0xe64100ff).into()), ..Default::default() }, ), @@ -788,14 +739,14 @@ pub fn noctis() -> UserThemeFamily { ( "link_text".into(), UserHighlightStyle { - color: Some(rgba(0x0095a8ff).into()), + color: Some(rgba(0x00bdd6ff).into()), ..Default::default() }, ), ( "link_uri".into(), UserHighlightStyle { - color: Some(rgba(0x0095a8ff).into()), + color: Some(rgba(0x00bdd6ff).into()), ..Default::default() }, ), @@ -806,13 +757,6 @@ pub fn noctis() -> UserThemeFamily { ..Default::default() }, ), - ( - "operator".into(), - UserHighlightStyle { - font_weight: Some(UserFontWeight(700.0)), - ..Default::default() - }, - ), ( "property".into(), UserHighlightStyle { @@ -823,7 +767,7 @@ pub fn noctis() -> UserThemeFamily { ( "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x9995b7ff).into()), + color: Some(rgba(0x0c006bff).into()), ..Default::default() }, ), @@ -851,7 +795,7 @@ pub fn noctis() -> UserThemeFamily { ( "tag".into(), UserHighlightStyle { - color: Some(rgba(0xff5792ff).into()), + color: Some(rgba(0xe64100ff).into()), ..Default::default() }, ), @@ -872,7 +816,7 @@ pub fn noctis() -> UserThemeFamily { ( "type".into(), UserHighlightStyle { - color: Some(rgba(0x00bdd6ff).into()), + color: Some(rgba(0xb3694dff).into()), ..Default::default() }, ), @@ -964,23 +908,16 @@ pub fn noctis() -> UserThemeFamily { }, ), ( - "constant".into(), - UserHighlightStyle { - color: Some(rgba(0x004d57ff).into()), - ..Default::default() - }, - ), - ( - "constructor".into(), + "comment.doc".into(), UserHighlightStyle { - font_weight: Some(UserFontWeight(700.0)), + color: Some(rgba(0x8ca6a6ff).into()), ..Default::default() }, ), ( - "emphasis".into(), + "constant".into(), UserHighlightStyle { - font_style: Some(UserFontStyle::Italic), + color: Some(rgba(0x004d57ff).into()), ..Default::default() }, ), @@ -994,7 +931,7 @@ pub fn noctis() -> UserThemeFamily { ( "keyword".into(), UserHighlightStyle { - color: Some(rgba(0xff5792ff).into()), + color: Some(rgba(0xe64100ff).into()), ..Default::default() }, ), @@ -1008,14 +945,14 @@ pub fn noctis() -> UserThemeFamily { ( "link_text".into(), UserHighlightStyle { - color: Some(rgba(0x0095a8ff).into()), + color: Some(rgba(0x00bdd6ff).into()), ..Default::default() }, ), ( "link_uri".into(), UserHighlightStyle { - color: Some(rgba(0x0095a8ff).into()), + color: Some(rgba(0x00bdd6ff).into()), ..Default::default() }, ), @@ -1026,13 +963,6 @@ pub fn noctis() -> UserThemeFamily { ..Default::default() }, ), - ( - "operator".into(), - UserHighlightStyle { - font_weight: Some(UserFontWeight(700.0)), - ..Default::default() - }, - ), ( "property".into(), UserHighlightStyle { @@ -1043,7 +973,7 @@ pub fn noctis() -> UserThemeFamily { ( "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x8ca6a6ff).into()), + color: Some(rgba(0x004d57ff).into()), ..Default::default() }, ), @@ -1071,7 +1001,7 @@ pub fn noctis() -> UserThemeFamily { ( "tag".into(), UserHighlightStyle { - color: Some(rgba(0xff5792ff).into()), + color: Some(rgba(0xe64100ff).into()), ..Default::default() }, ), @@ -1092,7 +1022,7 @@ pub fn noctis() -> UserThemeFamily { ( "type".into(), UserHighlightStyle { - color: Some(rgba(0x00bdd6ff).into()), + color: Some(rgba(0xb3694dff).into()), ..Default::default() }, ), @@ -1184,23 +1114,16 @@ pub fn noctis() -> UserThemeFamily { }, ), ( - "constant".into(), - UserHighlightStyle { - color: Some(rgba(0xc5cdd3ff).into()), - ..Default::default() - }, - ), - ( - "constructor".into(), + "comment.doc".into(), UserHighlightStyle { - font_weight: Some(UserFontWeight(700.0)), + color: Some(rgba(0x5e7887ff).into()), ..Default::default() }, ), ( - "emphasis".into(), + "constant".into(), UserHighlightStyle { - font_style: Some(UserFontStyle::Italic), + color: Some(rgba(0xc5cdd3ff).into()), ..Default::default() }, ), @@ -1214,7 +1137,7 @@ pub fn noctis() -> UserThemeFamily { ( "keyword".into(), UserHighlightStyle { - color: Some(rgba(0xc88da2ff).into()), + color: Some(rgba(0xc37455ff).into()), ..Default::default() }, ), @@ -1228,14 +1151,14 @@ pub fn noctis() -> UserThemeFamily { ( "link_text".into(), UserHighlightStyle { - color: Some(rgba(0x3f848dff).into()), + color: Some(rgba(0x72b7c0ff).into()), ..Default::default() }, ), ( "link_uri".into(), UserHighlightStyle { - color: Some(rgba(0x3f848dff).into()), + color: Some(rgba(0x72b7c0ff).into()), ..Default::default() }, ), @@ -1246,13 +1169,6 @@ pub fn noctis() -> UserThemeFamily { ..Default::default() }, ), - ( - "operator".into(), - UserHighlightStyle { - font_weight: Some(UserFontWeight(700.0)), - ..Default::default() - }, - ), ( "property".into(), UserHighlightStyle { @@ -1263,7 +1179,7 @@ pub fn noctis() -> UserThemeFamily { ( "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x5e7887ff).into()), + color: Some(rgba(0xc5cdd3ff).into()), ..Default::default() }, ), @@ -1291,7 +1207,7 @@ pub fn noctis() -> UserThemeFamily { ( "tag".into(), UserHighlightStyle { - color: Some(rgba(0xc88da2ff).into()), + color: Some(rgba(0xc37455ff).into()), ..Default::default() }, ), @@ -1312,7 +1228,7 @@ pub fn noctis() -> UserThemeFamily { ( "type".into(), UserHighlightStyle { - color: Some(rgba(0x72b7c0ff).into()), + color: Some(rgba(0xbe856fff).into()), ..Default::default() }, ), @@ -1404,23 +1320,16 @@ pub fn noctis() -> UserThemeFamily { }, ), ( - "constant".into(), + "comment.doc".into(), UserHighlightStyle { - color: Some(rgba(0xb2cacdff).into()), - ..Default::default() - }, - ), - ( - "constructor".into(), - UserHighlightStyle { - font_weight: Some(UserFontWeight(700.0)), + color: Some(rgba(0x5b858bff).into()), ..Default::default() }, ), ( - "emphasis".into(), + "constant".into(), UserHighlightStyle { - font_style: Some(UserFontStyle::Italic), + color: Some(rgba(0xb2cacdff).into()), ..Default::default() }, ), @@ -1434,7 +1343,7 @@ pub fn noctis() -> UserThemeFamily { ( "keyword".into(), UserHighlightStyle { - color: Some(rgba(0xdf769bff).into()), + color: Some(rgba(0xe66533ff).into()), ..Default::default() }, ), @@ -1448,14 +1357,14 @@ pub fn noctis() -> UserThemeFamily { ( "link_text".into(), UserHighlightStyle { - color: Some(rgba(0x16a3b6ff).into()), + color: Some(rgba(0x49d6e9ff).into()), ..Default::default() }, ), ( "link_uri".into(), UserHighlightStyle { - color: Some(rgba(0x16a3b6ff).into()), + color: Some(rgba(0x49d6e9ff).into()), ..Default::default() }, ), @@ -1466,13 +1375,6 @@ pub fn noctis() -> UserThemeFamily { ..Default::default() }, ), - ( - "operator".into(), - UserHighlightStyle { - font_weight: Some(UserFontWeight(700.0)), - ..Default::default() - }, - ), ( "property".into(), UserHighlightStyle { @@ -1483,7 +1385,7 @@ pub fn noctis() -> UserThemeFamily { ( "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x5b858bff).into()), + color: Some(rgba(0xb2cacdff).into()), ..Default::default() }, ), @@ -1511,7 +1413,7 @@ pub fn noctis() -> UserThemeFamily { ( "tag".into(), UserHighlightStyle { - color: Some(rgba(0xdf769bff).into()), + color: Some(rgba(0xe66533ff).into()), ..Default::default() }, ), @@ -1532,7 +1434,7 @@ pub fn noctis() -> UserThemeFamily { ( "type".into(), UserHighlightStyle { - color: Some(rgba(0x49d6e9ff).into()), + color: Some(rgba(0xd67e5cff).into()), ..Default::default() }, ), @@ -1624,23 +1526,16 @@ pub fn noctis() -> UserThemeFamily { }, ), ( - "constant".into(), + "comment.doc".into(), UserHighlightStyle { - color: Some(rgba(0xb2cacdff).into()), - ..Default::default() - }, - ), - ( - "constructor".into(), - UserHighlightStyle { - font_weight: Some(UserFontWeight(700.0)), + color: Some(rgba(0x5b858bff).into()), ..Default::default() }, ), ( - "emphasis".into(), + "constant".into(), UserHighlightStyle { - font_style: Some(UserFontStyle::Italic), + color: Some(rgba(0xb2cacdff).into()), ..Default::default() }, ), @@ -1654,7 +1549,7 @@ pub fn noctis() -> UserThemeFamily { ( "keyword".into(), UserHighlightStyle { - color: Some(rgba(0xdf769bff).into()), + color: Some(rgba(0xe66533ff).into()), ..Default::default() }, ), @@ -1668,14 +1563,14 @@ pub fn noctis() -> UserThemeFamily { ( "link_text".into(), UserHighlightStyle { - color: Some(rgba(0x16a3b6ff).into()), + color: Some(rgba(0x49d6e9ff).into()), ..Default::default() }, ), ( "link_uri".into(), UserHighlightStyle { - color: Some(rgba(0x16a3b6ff).into()), + color: Some(rgba(0x49d6e9ff).into()), ..Default::default() }, ), @@ -1686,13 +1581,6 @@ pub fn noctis() -> UserThemeFamily { ..Default::default() }, ), - ( - "operator".into(), - UserHighlightStyle { - font_weight: Some(UserFontWeight(700.0)), - ..Default::default() - }, - ), ( "property".into(), UserHighlightStyle { @@ -1703,7 +1591,7 @@ pub fn noctis() -> UserThemeFamily { ( "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x5b858bff).into()), + color: Some(rgba(0xb2cacdff).into()), ..Default::default() }, ), @@ -1731,7 +1619,7 @@ pub fn noctis() -> UserThemeFamily { ( "tag".into(), UserHighlightStyle { - color: Some(rgba(0xdf769bff).into()), + color: Some(rgba(0xe66533ff).into()), ..Default::default() }, ), @@ -1752,7 +1640,7 @@ pub fn noctis() -> UserThemeFamily { ( "type".into(), UserHighlightStyle { - color: Some(rgba(0x49d6e9ff).into()), + color: Some(rgba(0xd67e5cff).into()), ..Default::default() }, ), @@ -1844,23 +1732,16 @@ pub fn noctis() -> UserThemeFamily { }, ), ( - "constant".into(), - UserHighlightStyle { - color: Some(rgba(0xb2cacdff).into()), - ..Default::default() - }, - ), - ( - "constructor".into(), + "comment.doc".into(), UserHighlightStyle { - font_weight: Some(UserFontWeight(700.0)), + color: Some(rgba(0x5b858bff).into()), ..Default::default() }, ), ( - "emphasis".into(), + "constant".into(), UserHighlightStyle { - font_style: Some(UserFontStyle::Italic), + color: Some(rgba(0xb2cacdff).into()), ..Default::default() }, ), @@ -1874,7 +1755,7 @@ pub fn noctis() -> UserThemeFamily { ( "keyword".into(), UserHighlightStyle { - color: Some(rgba(0xdf769bff).into()), + color: Some(rgba(0xe66533ff).into()), ..Default::default() }, ), @@ -1888,14 +1769,14 @@ pub fn noctis() -> UserThemeFamily { ( "link_text".into(), UserHighlightStyle { - color: Some(rgba(0x16a3b6ff).into()), + color: Some(rgba(0x49d6e9ff).into()), ..Default::default() }, ), ( "link_uri".into(), UserHighlightStyle { - color: Some(rgba(0x16a3b6ff).into()), + color: Some(rgba(0x49d6e9ff).into()), ..Default::default() }, ), @@ -1906,13 +1787,6 @@ pub fn noctis() -> UserThemeFamily { ..Default::default() }, ), - ( - "operator".into(), - UserHighlightStyle { - font_weight: Some(UserFontWeight(700.0)), - ..Default::default() - }, - ), ( "property".into(), UserHighlightStyle { @@ -1923,7 +1797,7 @@ pub fn noctis() -> UserThemeFamily { ( "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x5b858bff).into()), + color: Some(rgba(0xb2cacdff).into()), ..Default::default() }, ), @@ -1951,7 +1825,7 @@ pub fn noctis() -> UserThemeFamily { ( "tag".into(), UserHighlightStyle { - color: Some(rgba(0xdf769bff).into()), + color: Some(rgba(0xe66533ff).into()), ..Default::default() }, ), @@ -1972,7 +1846,7 @@ pub fn noctis() -> UserThemeFamily { ( "type".into(), UserHighlightStyle { - color: Some(rgba(0x49d6e9ff).into()), + color: Some(rgba(0xd67e5cff).into()), ..Default::default() }, ), @@ -2064,23 +1938,16 @@ pub fn noctis() -> UserThemeFamily { }, ), ( - "constant".into(), - UserHighlightStyle { - color: Some(rgba(0xc5c2d6ff).into()), - ..Default::default() - }, - ), - ( - "constructor".into(), + "comment.doc".into(), UserHighlightStyle { - font_weight: Some(UserFontWeight(700.0)), + color: Some(rgba(0x716c93ff).into()), ..Default::default() }, ), ( - "emphasis".into(), + "constant".into(), UserHighlightStyle { - font_style: Some(UserFontStyle::Italic), + color: Some(rgba(0xc5c2d6ff).into()), ..Default::default() }, ), @@ -2094,7 +1961,7 @@ pub fn noctis() -> UserThemeFamily { ( "keyword".into(), UserHighlightStyle { - color: Some(rgba(0xdf769bff).into()), + color: Some(rgba(0xe66533ff).into()), ..Default::default() }, ), @@ -2108,14 +1975,14 @@ pub fn noctis() -> UserThemeFamily { ( "link_text".into(), UserHighlightStyle { - color: Some(rgba(0x16a3b6ff).into()), + color: Some(rgba(0x49d6e9ff).into()), ..Default::default() }, ), ( "link_uri".into(), UserHighlightStyle { - color: Some(rgba(0x16a3b6ff).into()), + color: Some(rgba(0x49d6e9ff).into()), ..Default::default() }, ), @@ -2126,13 +1993,6 @@ pub fn noctis() -> UserThemeFamily { ..Default::default() }, ), - ( - "operator".into(), - UserHighlightStyle { - font_weight: Some(UserFontWeight(700.0)), - ..Default::default() - }, - ), ( "property".into(), UserHighlightStyle { @@ -2143,7 +2003,7 @@ pub fn noctis() -> UserThemeFamily { ( "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x716c93ff).into()), + color: Some(rgba(0xc5c2d6ff).into()), ..Default::default() }, ), @@ -2171,7 +2031,7 @@ pub fn noctis() -> UserThemeFamily { ( "tag".into(), UserHighlightStyle { - color: Some(rgba(0xdf769bff).into()), + color: Some(rgba(0xe66533ff).into()), ..Default::default() }, ), @@ -2192,7 +2052,7 @@ pub fn noctis() -> UserThemeFamily { ( "type".into(), UserHighlightStyle { - color: Some(rgba(0x49d6e9ff).into()), + color: Some(rgba(0xd67e5cff).into()), ..Default::default() }, ), @@ -2284,23 +2144,16 @@ pub fn noctis() -> UserThemeFamily { }, ), ( - "constant".into(), - UserHighlightStyle { - color: Some(rgba(0xccbfd9ff).into()), - ..Default::default() - }, - ), - ( - "constructor".into(), + "comment.doc".into(), UserHighlightStyle { - font_weight: Some(UserFontWeight(700.0)), + color: Some(rgba(0x7f659aff).into()), ..Default::default() }, ), ( - "emphasis".into(), + "constant".into(), UserHighlightStyle { - font_style: Some(UserFontStyle::Italic), + color: Some(rgba(0xccbfd9ff).into()), ..Default::default() }, ), @@ -2314,7 +2167,7 @@ pub fn noctis() -> UserThemeFamily { ( "keyword".into(), UserHighlightStyle { - color: Some(rgba(0xdf769bff).into()), + color: Some(rgba(0xe66533ff).into()), ..Default::default() }, ), @@ -2328,14 +2181,14 @@ pub fn noctis() -> UserThemeFamily { ( "link_text".into(), UserHighlightStyle { - color: Some(rgba(0x16a3b6ff).into()), + color: Some(rgba(0x49d6e9ff).into()), ..Default::default() }, ), ( "link_uri".into(), UserHighlightStyle { - color: Some(rgba(0x16a3b6ff).into()), + color: Some(rgba(0x49d6e9ff).into()), ..Default::default() }, ), @@ -2346,13 +2199,6 @@ pub fn noctis() -> UserThemeFamily { ..Default::default() }, ), - ( - "operator".into(), - UserHighlightStyle { - font_weight: Some(UserFontWeight(700.0)), - ..Default::default() - }, - ), ( "property".into(), UserHighlightStyle { @@ -2363,7 +2209,7 @@ pub fn noctis() -> UserThemeFamily { ( "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x7f659aff).into()), + color: Some(rgba(0xccbfd9ff).into()), ..Default::default() }, ), @@ -2391,7 +2237,7 @@ pub fn noctis() -> UserThemeFamily { ( "tag".into(), UserHighlightStyle { - color: Some(rgba(0xdf769bff).into()), + color: Some(rgba(0xe66533ff).into()), ..Default::default() }, ), @@ -2412,7 +2258,7 @@ pub fn noctis() -> UserThemeFamily { ( "type".into(), UserHighlightStyle { - color: Some(rgba(0x49d6e9ff).into()), + color: Some(rgba(0xd67e5cff).into()), ..Default::default() }, ), diff --git a/crates/theme2/src/themes/nord.rs b/crates/theme2/src/themes/nord.rs index e1c4e35f584c67c5856b6693c16cff2ea1b46500..cc863f37160e23c0eb5dbda4f2c65e526ab25be5 100644 --- a/crates/theme2/src/themes/nord.rs +++ b/crates/theme2/src/themes/nord.rs @@ -90,16 +90,16 @@ pub fn nord() -> UserThemeFamily { }, ), ( - "constant".into(), + "comment.doc".into(), UserHighlightStyle { - color: Some(rgba(0xebcb8bff).into()), + color: Some(rgba(0x616e88ff).into()), ..Default::default() }, ), ( - "emphasis.strong".into(), + "constant".into(), UserHighlightStyle { - font_weight: Some(UserFontWeight(700.0)), + color: Some(rgba(0xebcb8bff).into()), ..Default::default() }, ), @@ -134,7 +134,7 @@ pub fn nord() -> UserThemeFamily { ( "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0xeceff4ff).into()), + color: Some(rgba(0x81a1c1ff).into()), ..Default::default() }, ), @@ -183,7 +183,7 @@ pub fn nord() -> UserThemeFamily { ( "variable".into(), UserHighlightStyle { - color: Some(rgba(0x81a1c1ff).into()), + color: Some(rgba(0xd8dee9ff).into()), ..Default::default() }, ), diff --git a/crates/theme2/src/themes/palenight.rs b/crates/theme2/src/themes/palenight.rs index 21e77dbacfcc880ee2324c668bac451451d5cf13..daee43f572fedbb82a301e41c50cbe8e0ae145dc 100644 --- a/crates/theme2/src/themes/palenight.rs +++ b/crates/theme2/src/themes/palenight.rs @@ -89,6 +89,14 @@ pub fn palenight() -> UserThemeFamily { ..Default::default() }, ), + ( + "comment.doc".into(), + UserHighlightStyle { + color: Some(rgba(0x697098ff).into()), + font_style: Some(UserFontStyle::Italic), + ..Default::default() + }, + ), ( "constant".into(), UserHighlightStyle { @@ -164,7 +172,7 @@ pub fn palenight() -> UserThemeFamily { ( "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0xc792eaff).into()), + color: Some(rgba(0x89ddffff).into()), ..Default::default() }, ), @@ -206,7 +214,7 @@ pub fn palenight() -> UserThemeFamily { ( "variable".into(), UserHighlightStyle { - color: Some(rgba(0xffcb6bff).into()), + color: Some(rgba(0xff5572ff).into()), ..Default::default() }, ), @@ -296,6 +304,14 @@ pub fn palenight() -> UserThemeFamily { ..Default::default() }, ), + ( + "comment.doc".into(), + UserHighlightStyle { + color: Some(rgba(0x697098ff).into()), + font_style: Some(UserFontStyle::Italic), + ..Default::default() + }, + ), ( "constant".into(), UserHighlightStyle { @@ -371,7 +387,7 @@ pub fn palenight() -> UserThemeFamily { ( "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0xc792eaff).into()), + color: Some(rgba(0x89ddffff).into()), ..Default::default() }, ), @@ -413,7 +429,7 @@ pub fn palenight() -> UserThemeFamily { ( "variable".into(), UserHighlightStyle { - color: Some(rgba(0xffcb6bff).into()), + color: Some(rgba(0xff5572ff).into()), ..Default::default() }, ), @@ -503,6 +519,14 @@ pub fn palenight() -> UserThemeFamily { ..Default::default() }, ), + ( + "comment.doc".into(), + UserHighlightStyle { + color: Some(rgba(0x697098ff).into()), + font_style: Some(UserFontStyle::Italic), + ..Default::default() + }, + ), ( "constant".into(), UserHighlightStyle { @@ -578,7 +602,7 @@ pub fn palenight() -> UserThemeFamily { ( "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0xc792eaff).into()), + color: Some(rgba(0x89ddffff).into()), ..Default::default() }, ), @@ -620,7 +644,7 @@ pub fn palenight() -> UserThemeFamily { ( "variable".into(), UserHighlightStyle { - color: Some(rgba(0xffcb6bff).into()), + color: Some(rgba(0xff5572ff).into()), ..Default::default() }, ), diff --git a/crates/theme2/src/themes/rose_pine.rs b/crates/theme2/src/themes/rose_pine.rs index 7107bb79a33ab65bc623317aa36a037477f9d011..f4de7fb0d36721bf1ec24eefcba011bedcb4f622 100644 --- a/crates/theme2/src/themes/rose_pine.rs +++ b/crates/theme2/src/themes/rose_pine.rs @@ -92,13 +92,20 @@ pub fn rose_pine() -> UserThemeFamily { }, ), ( - "function".into(), + "comment.doc".into(), UserHighlightStyle { - color: Some(rgba(0xeb6f92ff).into()), + color: Some(rgba(0x6e6a86ff).into()), font_style: Some(UserFontStyle::Italic), ..Default::default() }, ), + ( + "function".into(), + UserHighlightStyle { + color: Some(rgba(0xe0def4ff).into()), + ..Default::default() + }, + ), ( "keyword".into(), UserHighlightStyle { @@ -123,7 +130,7 @@ pub fn rose_pine() -> UserThemeFamily { ( "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x908caaff).into()), + color: Some(rgba(0x6e6a86ff).into()), ..Default::default() }, ), @@ -165,8 +172,7 @@ pub fn rose_pine() -> UserThemeFamily { ( "variable".into(), UserHighlightStyle { - color: Some(rgba(0xebbcbaff).into()), - font_style: Some(UserFontStyle::Italic), + color: Some(rgba(0xc4a7e7ff).into()), ..Default::default() }, ), @@ -259,13 +265,20 @@ pub fn rose_pine() -> UserThemeFamily { }, ), ( - "function".into(), + "comment.doc".into(), UserHighlightStyle { - color: Some(rgba(0xeb6f92ff).into()), + color: Some(rgba(0x6e6a86ff).into()), font_style: Some(UserFontStyle::Italic), ..Default::default() }, ), + ( + "function".into(), + UserHighlightStyle { + color: Some(rgba(0xe0def4ff).into()), + ..Default::default() + }, + ), ( "keyword".into(), UserHighlightStyle { @@ -290,7 +303,7 @@ pub fn rose_pine() -> UserThemeFamily { ( "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x908caaff).into()), + color: Some(rgba(0x6e6a86ff).into()), ..Default::default() }, ), @@ -332,8 +345,7 @@ pub fn rose_pine() -> UserThemeFamily { ( "variable".into(), UserHighlightStyle { - color: Some(rgba(0xea9a97ff).into()), - font_style: Some(UserFontStyle::Italic), + color: Some(rgba(0xc4a7e7ff).into()), ..Default::default() }, ), @@ -426,13 +438,20 @@ pub fn rose_pine() -> UserThemeFamily { }, ), ( - "function".into(), + "comment.doc".into(), UserHighlightStyle { - color: Some(rgba(0xb4637aff).into()), + color: Some(rgba(0x9893a5ff).into()), font_style: Some(UserFontStyle::Italic), ..Default::default() }, ), + ( + "function".into(), + UserHighlightStyle { + color: Some(rgba(0x575279ff).into()), + ..Default::default() + }, + ), ( "keyword".into(), UserHighlightStyle { @@ -457,7 +476,7 @@ pub fn rose_pine() -> UserThemeFamily { ( "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x797593ff).into()), + color: Some(rgba(0x9893a5ff).into()), ..Default::default() }, ), @@ -499,8 +518,7 @@ pub fn rose_pine() -> UserThemeFamily { ( "variable".into(), UserHighlightStyle { - color: Some(rgba(0xd7827eff).into()), - font_style: Some(UserFontStyle::Italic), + color: Some(rgba(0x907aa9ff).into()), ..Default::default() }, ), diff --git a/crates/theme2/src/themes/solarized.rs b/crates/theme2/src/themes/solarized.rs index 12e3d1f3996c321015ff818fb7e0e5209eee1965..e77d2e79f943a6474f41ec79fcb9abd363b3d4d8 100644 --- a/crates/theme2/src/themes/solarized.rs +++ b/crates/theme2/src/themes/solarized.rs @@ -86,6 +86,14 @@ pub fn solarized() -> UserThemeFamily { ..Default::default() }, ), + ( + "comment.doc".into(), + UserHighlightStyle { + color: Some(rgba(0x657b83ff).into()), + font_style: Some(UserFontStyle::Italic), + ..Default::default() + }, + ), ( "constant".into(), UserHighlightStyle { @@ -117,14 +125,14 @@ pub fn solarized() -> UserThemeFamily { ( "function".into(), UserHighlightStyle { - color: Some(rgba(0x268bd2ff).into()), + color: Some(rgba(0x839496ff).into()), ..Default::default() }, ), ( "keyword".into(), UserHighlightStyle { - color: Some(rgba(0x859900ff).into()), + color: Some(rgba(0x268bd2ff).into()), ..Default::default() }, ), @@ -180,14 +188,14 @@ pub fn solarized() -> UserThemeFamily { ( "type".into(), UserHighlightStyle { - color: Some(rgba(0xcb4b16ff).into()), + color: Some(rgba(0x859900ff).into()), ..Default::default() }, ), ( "variable".into(), UserHighlightStyle { - color: Some(rgba(0x268bd2ff).into()), + color: Some(rgba(0x839496ff).into()), ..Default::default() }, ), @@ -271,6 +279,14 @@ pub fn solarized() -> UserThemeFamily { ..Default::default() }, ), + ( + "comment.doc".into(), + UserHighlightStyle { + color: Some(rgba(0x93a1a1ff).into()), + font_style: Some(UserFontStyle::Italic), + ..Default::default() + }, + ), ( "constant".into(), UserHighlightStyle { @@ -302,14 +318,14 @@ pub fn solarized() -> UserThemeFamily { ( "function".into(), UserHighlightStyle { - color: Some(rgba(0x268bd2ff).into()), + color: Some(rgba(0x657b83ff).into()), ..Default::default() }, ), ( "keyword".into(), UserHighlightStyle { - color: Some(rgba(0x859900ff).into()), + color: Some(rgba(0x268bd2ff).into()), ..Default::default() }, ), @@ -358,7 +374,7 @@ pub fn solarized() -> UserThemeFamily { ( "type".into(), UserHighlightStyle { - color: Some(rgba(0x268bd2ff).into()), + color: Some(rgba(0x859900ff).into()), ..Default::default() }, ), diff --git a/crates/theme2/src/themes/synthwave_84.rs b/crates/theme2/src/themes/synthwave_84.rs index 731c2527f569332042a8d0aea7f2c09176c10301..585d584c6897334b57bd1cfb2414bc1baf4acde5 100644 --- a/crates/theme2/src/themes/synthwave_84.rs +++ b/crates/theme2/src/themes/synthwave_84.rs @@ -75,6 +75,14 @@ pub fn synthwave_84() -> UserThemeFamily { ..Default::default() }, ), + ( + "comment.doc".into(), + UserHighlightStyle { + color: Some(rgba(0x848bbdff).into()), + font_style: Some(UserFontStyle::Italic), + ..Default::default() + }, + ), ( "function".into(), UserHighlightStyle { @@ -162,7 +170,8 @@ pub fn synthwave_84() -> UserThemeFamily { ( "variable".into(), UserHighlightStyle { - color: Some(rgba(0xff7edbff).into()), + color: Some(rgba(0xfe4450ff).into()), + font_weight: Some(UserFontWeight(700.0)), ..Default::default() }, ), diff --git a/crates/theme_importer/src/main.rs b/crates/theme_importer/src/main.rs index 24e95ca91823ed6265cca81e778d45e938816b88..80e979df983243da030b23a113fb666cfe52509f 100644 --- a/crates/theme_importer/src/main.rs +++ b/crates/theme_importer/src/main.rs @@ -15,7 +15,7 @@ use gpui::serde_json; use json_comments::StripComments; use log::LevelFilter; use serde::Deserialize; -use simplelog::SimpleLogger; +use simplelog::{TermLogger, TerminalMode}; use theme::{Appearance, UserThemeFamily}; use crate::theme_printer::UserThemeFamilyPrinter; @@ -56,9 +56,17 @@ fn main() -> Result<()> { const SOURCE_PATH: &str = "assets/themes/src/vscode"; const OUT_PATH: &str = "crates/theme2/src/themes"; - SimpleLogger::init(LevelFilter::Info, Default::default()).expect("could not initialize logger"); + let log_config = simplelog::ConfigBuilder::new() + .set_level_color(log::Level::Trace, simplelog::Color::Cyan) + .set_level_color(log::Level::Info, simplelog::Color::Blue) + .set_level_color(log::Level::Warn, simplelog::Color::Yellow) + .set_level_color(log::Level::Error, simplelog::Color::Red) + .build(); - println!("Loading themes source..."); + TermLogger::init(LevelFilter::Trace, log_config, TerminalMode::Mixed) + .expect("could not initialize logger"); + + log::info!("Loading themes source..."); let vscode_themes_path = PathBuf::from_str(SOURCE_PATH)?; if !vscode_themes_path.exists() { return Err(anyhow!(format!( @@ -91,7 +99,7 @@ fn main() -> Result<()> { let license_file_path = theme_family_dir.path().join("LICENSE"); if !license_file_path.exists() { - println!("Skipping theme family '{}' because it does not have a LICENSE file. This theme will only be imported once a LICENSE file is provided.", theme_family_slug); + log::info!("Skipping theme family '{}' because it does not have a LICENSE file. This theme will only be imported once a LICENSE file is provided.", theme_family_slug); continue; } @@ -103,12 +111,14 @@ fn main() -> Result<()> { let mut themes = Vec::new(); for theme_metadata in family_metadata.themes { + log::info!("Converting '{}' theme", &theme_metadata.name); + let theme_file_path = theme_family_dir.path().join(&theme_metadata.file_name); let theme_file = match File::open(&theme_file_path) { Ok(file) => file, Err(_) => { - println!("Failed to open file at path: {:?}", theme_file_path); + log::info!("Failed to open file at path: {:?}", theme_file_path); continue; } }; @@ -136,7 +146,7 @@ fn main() -> Result<()> { let themes_output_path = PathBuf::from_str(OUT_PATH)?; if !themes_output_path.exists() { - println!("Creating directory: {:?}", themes_output_path); + log::info!("Creating directory: {:?}", themes_output_path); fs::create_dir_all(&themes_output_path)?; } @@ -149,7 +159,7 @@ fn main() -> Result<()> { let mut output_file = File::create(themes_output_path.join(format!("{theme_family_slug}.rs")))?; - println!( + log::info!( "Creating file: {:?}", themes_output_path.join(format!("{theme_family_slug}.rs")) ); @@ -220,17 +230,17 @@ fn main() -> Result<()> { mod_rs_file.write_all(mod_rs_contents.as_bytes())?; - println!("Formatting themes..."); + log::info!("Formatting themes..."); let format_result = format_themes_crate() // We need to format a second time to catch all of the formatting issues. .and_then(|_| format_themes_crate()); if let Err(err) = format_result { - eprintln!("Failed to format themes: {}", err); + log::error!("Failed to format themes: {}", err); } - println!("Done!"); + log::info!("Done!"); Ok(()) } diff --git a/crates/theme_importer/src/vscode/converter.rs b/crates/theme_importer/src/vscode/converter.rs index bc8253e700f21647a36a4249d5280511c6209327..4e4b82a2c571c56841850b9022a77ed35c97e425 100644 --- a/crates/theme_importer/src/vscode/converter.rs +++ b/crates/theme_importer/src/vscode/converter.rs @@ -275,20 +275,31 @@ impl VsCodeThemeConverter { let mut highlight_styles = IndexMap::new(); for syntax_token in ZedSyntaxToken::iter() { - let multimatch_scopes = syntax_token.to_vscode(); - - let token_color = self.theme.token_colors.iter().find(|token_color| { - token_color - .scope - .as_ref() - .map(|scope| scope.multimatch(&multimatch_scopes)) - .unwrap_or(false) - }); + let best_match = syntax_token + .find_best_token_color_match(&self.theme.token_colors) + .or_else(|| { + syntax_token.fallbacks().iter().find_map(|fallback| { + fallback.find_best_token_color_match(&self.theme.token_colors) + }) + }); - let Some(token_color) = token_color else { + let Some(token_color) = best_match else { + log::warn!("No matching token color found for '{syntax_token}'"); continue; }; + log::info!( + "Matched '{syntax_token}' to '{}'", + token_color + .name + .clone() + .or_else(|| token_color + .scope + .as_ref() + .map(|scope| format!("{:?}", scope))) + .unwrap_or_else(|| "no identifier".to_string()) + ); + let highlight_style = UserHighlightStyle { color: token_color .settings diff --git a/crates/theme_importer/src/vscode/syntax.rs b/crates/theme_importer/src/vscode/syntax.rs index 7f93925ee8f7eb9e04bb406645d6cae19e529d8c..318eb484c879d76127d425816e60fc0426505115 100644 --- a/crates/theme_importer/src/vscode/syntax.rs +++ b/crates/theme_importer/src/vscode/syntax.rs @@ -1,3 +1,4 @@ +use indexmap::IndexMap; use serde::Deserialize; use strum::EnumIter; @@ -8,19 +9,9 @@ pub enum VsCodeTokenScope { Many(Vec), } -impl VsCodeTokenScope { - pub fn multimatch(&self, matches: &[&'static str]) -> bool { - match self { - VsCodeTokenScope::One(scope) => matches.iter().any(|&s| s == scope), - VsCodeTokenScope::Many(scopes) => { - matches.iter().any(|s| scopes.contains(&s.to_string())) - } - } - } -} - #[derive(Debug, Deserialize)] pub struct VsCodeTokenColor { + pub name: Option, pub scope: Option, pub settings: VsCodeTokenColorSettings, } @@ -127,6 +118,60 @@ impl std::fmt::Display for ZedSyntaxToken { } impl ZedSyntaxToken { + pub fn find_best_token_color_match<'a>( + &self, + token_colors: &'a [VsCodeTokenColor], + ) -> Option<&'a VsCodeTokenColor> { + let mut ranked_matches = IndexMap::new(); + + for (ix, token_color) in token_colors.iter().enumerate() { + if token_color.settings.foreground.is_none() { + continue; + } + + let Some(rank) = self.rank_match(token_color) else { + continue; + }; + + if rank > 0 { + ranked_matches.insert(ix, rank); + } + } + + ranked_matches + .into_iter() + .max_by_key(|(_, rank)| *rank) + .map(|(ix, _)| &token_colors[ix]) + } + + fn rank_match(&self, token_color: &VsCodeTokenColor) -> Option { + let candidate_scopes = match token_color.scope.as_ref()? { + VsCodeTokenScope::One(scope) => vec![scope], + VsCodeTokenScope::Many(scopes) => scopes.iter().collect(), + } + .iter() + .map(|scope| scope.as_str()) + .collect::>(); + + let mut matches = 0; + + for scope in self.to_vscode() { + if candidate_scopes.contains(&scope) { + matches += 1; + } + } + + Some(matches) + } + + pub fn fallbacks(&self) -> &[Self] { + match self { + ZedSyntaxToken::CommentDoc => &[ZedSyntaxToken::Comment], + ZedSyntaxToken::VariableSpecial => &[ZedSyntaxToken::Variable], + _ => &[], + } + } + pub fn to_vscode(&self) -> Vec<&'static str> { match self { ZedSyntaxToken::Attribute => vec!["entity.other.attribute-name"], @@ -150,7 +195,15 @@ impl ZedSyntaxToken { "variable.function", "support.function", ], - ZedSyntaxToken::Keyword => vec!["keyword"], + ZedSyntaxToken::Hint => vec![], + ZedSyntaxToken::Keyword => vec![ + "keyword", + "keyword.control", + "keyword.control.fun", + "keyword.other.fn.rust", + "punctuation.accessor", + "entity.name.tag", + ], ZedSyntaxToken::Label => vec![ "label", "entity.name", @@ -161,7 +214,9 @@ impl ZedSyntaxToken { ZedSyntaxToken::LinkUri => vec!["markup.underline.link", "string.other.link"], ZedSyntaxToken::Number => vec!["constant.numeric", "number"], ZedSyntaxToken::Operator => vec!["operator", "keyword.operator"], + ZedSyntaxToken::Predictive => vec![], ZedSyntaxToken::Preproc => vec!["preproc"], + ZedSyntaxToken::Primary => vec![], ZedSyntaxToken::Property => vec![ "variable.member", "support.type.property-name", @@ -202,11 +257,20 @@ impl ZedSyntaxToken { ZedSyntaxToken::Tag => vec!["tag", "entity.name.tag", "meta.tag.sgml"], ZedSyntaxToken::TextLiteral => vec!["text.literal", "string"], ZedSyntaxToken::Title => vec!["title", "entity.name"], - ZedSyntaxToken::Type => vec!["entity.name.type", "support.type", "support.class"], + ZedSyntaxToken::Type => vec![ + "entity.name.type", + "entity.name.type.primitive", + "entity.name.type.numeric", + "keyword.type", + "support.type", + "support.type.primitive", + "support.class", + ], ZedSyntaxToken::Variable => vec![ "variable", "variable.language", "variable.member", + "variable.parameter", "variable.parameter.function-call", ], ZedSyntaxToken::VariableSpecial => vec![ @@ -216,7 +280,6 @@ impl ZedSyntaxToken { "variable.language", ], ZedSyntaxToken::Variant => vec!["variant"], - _ => vec![], } } }