diff --git a/Cargo.lock b/Cargo.lock index ba76a5db4a..863fb32d42 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9139,6 +9139,7 @@ dependencies = [ "rust-embed", "serde", "simplelog", + "strum", "theme2", "uuid 1.4.1", ] diff --git a/assets/themes/src/vscode/noctis/family.json b/assets/themes/src/vscode/noctis/family.json index 26aba7e213..525cb160f5 100644 --- a/assets/themes/src/vscode/noctis/family.json +++ b/assets/themes/src/vscode/noctis/family.json @@ -1,61 +1,61 @@ { - "name": "Notctis", - "author": "Liviu Schera (liviuschera)", - "themes": [ - { - "name": "Noctis Azureus", - "file_name": "azureus.json", - "appearance": "dark" - }, - { - "name": "Noctis Bordo", - "file_name": "bordo.json", - "appearance": "dark" - }, - { - "name": "Noctus Hibernus", - "file_name": "hibernus.json", - "appearance": "light" - }, - { - "name": "Noctis Lilac", - "file_name": "lilac.json", - "appearance": "dark" - }, - { - "name": "Noctis Lux", - "file_name": "lux.json", - "appearance": "light" - }, - { - "name": "Noctis Minimus", - "file_name": "minimus.json", - "appearance": "dark" - }, - { - "name": "Noctis", - "file_name": "noctis.json", - "appearance": "dark" - }, - { - "name": "Noctis Obscuro", - "file_name": "obscuro.json", - "appearance": "dark" - }, - { - "name": "Noctis Sereno", - "file_name": "obscuro.json", - "appearance": "dark" - }, - { - "name": "Noctis Uva", - "file_name": "uva.json", - "appearance": "dark" - }, - { - "name": "Noctis Viola", - "file_name": "viola.json", - "appearance": "dark" - } - ] + "name": "Noctis", + "author": "Liviu Schera (liviuschera)", + "themes": [ + { + "name": "Noctis Azureus", + "file_name": "azureus.json", + "appearance": "dark" + }, + { + "name": "Noctis Bordo", + "file_name": "bordo.json", + "appearance": "dark" + }, + { + "name": "Noctus Hibernus", + "file_name": "hibernus.json", + "appearance": "light" + }, + { + "name": "Noctis Lilac", + "file_name": "lilac.json", + "appearance": "dark" + }, + { + "name": "Noctis Lux", + "file_name": "lux.json", + "appearance": "light" + }, + { + "name": "Noctis Minimus", + "file_name": "minimus.json", + "appearance": "dark" + }, + { + "name": "Noctis", + "file_name": "noctis.json", + "appearance": "dark" + }, + { + "name": "Noctis Obscuro", + "file_name": "obscuro.json", + "appearance": "dark" + }, + { + "name": "Noctis Sereno", + "file_name": "obscuro.json", + "appearance": "dark" + }, + { + "name": "Noctis Uva", + "file_name": "uva.json", + "appearance": "dark" + }, + { + "name": "Noctis Viola", + "file_name": "viola.json", + "appearance": "dark" + } + ] } diff --git a/crates/theme2/src/registry.rs b/crates/theme2/src/registry.rs index 49546973c8..8f97354ec5 100644 --- a/crates/theme2/src/registry.rs +++ b/crates/theme2/src/registry.rs @@ -2,7 +2,7 @@ use std::collections::HashMap; use std::sync::Arc; use anyhow::{anyhow, Result}; -use gpui::SharedString; +use gpui::{HighlightStyle, SharedString}; use refineable::Refineable; use crate::{ @@ -39,9 +39,33 @@ impl ThemeRegistry { Appearance::Light => ThemeColors::default_light(), Appearance::Dark => ThemeColors::default_dark(), }; - theme_colors.refine(&user_theme.styles.colors); + let mut status_colors = StatusColors::default(); + status_colors.refine(&user_theme.styles.status); + + let mut syntax_colors = match user_theme.appearance { + Appearance::Light => SyntaxTheme::default_light(), + Appearance::Dark => SyntaxTheme::default_dark(), + }; + if let Some(user_syntax) = user_theme.styles.syntax { + syntax_colors.highlights = user_syntax + .highlights + .iter() + .map(|(syntax_token, highlight)| { + ( + syntax_token.clone(), + HighlightStyle { + color: highlight.color, + font_style: highlight.font_style.map(Into::into), + font_weight: highlight.font_weight.map(Into::into), + ..Default::default() + }, + ) + }) + .collect::>(); + } + Theme { id: uuid::Uuid::new_v4().to_string(), name: user_theme.name.into(), @@ -49,12 +73,9 @@ impl ThemeRegistry { styles: ThemeStyles { system: SystemColors::default(), colors: theme_colors, - status: StatusColors::default(), + status: status_colors, player: PlayerColors::default(), - syntax: match user_theme.appearance { - Appearance::Light => Arc::new(SyntaxTheme::default_light()), - Appearance::Dark => Arc::new(SyntaxTheme::default_dark()), - }, + syntax: Arc::new(syntax_colors), }, } })); diff --git a/crates/theme2/src/themes/andromeda.rs b/crates/theme2/src/themes/andromeda.rs index 5d1afae99c..27e09553a0 100644 --- a/crates/theme2/src/themes/andromeda.rs +++ b/crates/theme2/src/themes/andromeda.rs @@ -3,9 +3,10 @@ use gpui::rgba; +#[allow(unused)] use crate::{ - Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserHighlightStyle, UserSyntaxTheme, - UserTheme, UserThemeFamily, UserThemeStylesRefinement, + Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserFontStyle, UserFontWeight, + UserHighlightStyle, UserSyntaxTheme, UserTheme, UserThemeFamily, UserThemeStylesRefinement, }; pub fn andromeda() -> UserThemeFamily { @@ -61,6 +62,13 @@ pub fn andromeda() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ + ( + "attribute".into(), + UserHighlightStyle { + color: Some(rgba(0xf39c11ff).into()), + ..Default::default() + }, + ), ( "comment".into(), UserHighlightStyle { @@ -69,16 +77,30 @@ pub fn andromeda() -> UserThemeFamily { }, ), ( - "something".into(), + "function".into(), + UserHighlightStyle { + color: Some(rgba(0xffe66dff).into()), + ..Default::default() + }, + ), + ( + "keyword".into(), + UserHighlightStyle { + color: Some(rgba(0xc64dedff).into()), + ..Default::default() + }, + ), + ( + "string".into(), UserHighlightStyle { color: Some(rgba(0x95e072ff).into()), ..Default::default() }, ), ( - "punctuation".into(), + "type".into(), UserHighlightStyle { - color: Some(rgba(0x95e072ff).into()), + color: Some(rgba(0xffe66dff).into()), ..Default::default() }, ), @@ -134,6 +156,13 @@ pub fn andromeda() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ + ( + "attribute".into(), + UserHighlightStyle { + color: Some(rgba(0xf39c11ff).into()), + ..Default::default() + }, + ), ( "comment".into(), UserHighlightStyle { @@ -142,16 +171,30 @@ pub fn andromeda() -> UserThemeFamily { }, ), ( - "something".into(), + "function".into(), + UserHighlightStyle { + color: Some(rgba(0xffe66dff).into()), + ..Default::default() + }, + ), + ( + "keyword".into(), + UserHighlightStyle { + color: Some(rgba(0xc64dedff).into()), + ..Default::default() + }, + ), + ( + "string".into(), UserHighlightStyle { color: Some(rgba(0x95e072ff).into()), ..Default::default() }, ), ( - "punctuation".into(), + "type".into(), UserHighlightStyle { - color: Some(rgba(0x95e072ff).into()), + color: Some(rgba(0xffe66dff).into()), ..Default::default() }, ), diff --git a/crates/theme2/src/themes/ayu.rs b/crates/theme2/src/themes/ayu.rs index 14a8e47daf..f1138a2a1b 100644 --- a/crates/theme2/src/themes/ayu.rs +++ b/crates/theme2/src/themes/ayu.rs @@ -3,9 +3,10 @@ use gpui::rgba; +#[allow(unused)] use crate::{ - Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserHighlightStyle, UserSyntaxTheme, - UserTheme, UserThemeFamily, UserThemeStylesRefinement, + Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserFontStyle, UserFontWeight, + UserHighlightStyle, UserSyntaxTheme, UserTheme, UserThemeFamily, UserThemeStylesRefinement, }; pub fn ayu() -> UserThemeFamily { @@ -65,6 +66,20 @@ pub fn ayu() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ + ( + "attribute".into(), + UserHighlightStyle { + color: Some(rgba(0xf2ad48ff).into()), + ..Default::default() + }, + ), + ( + "boolean".into(), + UserHighlightStyle { + color: Some(rgba(0xa37accff).into()), + ..Default::default() + }, + ), ( "comment".into(), UserHighlightStyle { @@ -74,16 +89,38 @@ pub fn ayu() -> UserThemeFamily { }, ), ( - "something".into(), + "constant".into(), + UserHighlightStyle { + color: Some(rgba(0x4bbf98ff).into()), + ..Default::default() + }, + ), + ( + "function".into(), + UserHighlightStyle { + color: Some(rgba(0xf2ad48ff).into()), + ..Default::default() + }, + ), + ( + "keyword".into(), UserHighlightStyle { color: Some(rgba(0xfa8d3eff).into()), ..Default::default() }, ), ( - "punctuation".into(), + "string".into(), UserHighlightStyle { - color: Some(rgba(0x787b8099).into()), + color: Some(rgba(0x86b300ff).into()), + ..Default::default() + }, + ), + ( + "variable".into(), + UserHighlightStyle { + color: Some(rgba(0x55b4d3ff).into()), + font_style: Some(UserFontStyle::Italic), ..Default::default() }, ), @@ -143,6 +180,20 @@ pub fn ayu() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ + ( + "attribute".into(), + UserHighlightStyle { + color: Some(rgba(0xffd173ff).into()), + ..Default::default() + }, + ), + ( + "boolean".into(), + UserHighlightStyle { + color: Some(rgba(0xdfbfffff).into()), + ..Default::default() + }, + ), ( "comment".into(), UserHighlightStyle { @@ -152,16 +203,38 @@ pub fn ayu() -> UserThemeFamily { }, ), ( - "something".into(), + "constant".into(), + UserHighlightStyle { + color: Some(rgba(0x95e6cbff).into()), + ..Default::default() + }, + ), + ( + "function".into(), + UserHighlightStyle { + color: Some(rgba(0xffd173ff).into()), + ..Default::default() + }, + ), + ( + "keyword".into(), UserHighlightStyle { color: Some(rgba(0xffad65ff).into()), ..Default::default() }, ), ( - "punctuation".into(), + "string".into(), UserHighlightStyle { - color: Some(rgba(0xb8cfe680).into()), + color: Some(rgba(0xd4fe7fff).into()), + ..Default::default() + }, + ), + ( + "variable".into(), + UserHighlightStyle { + color: Some(rgba(0x5ccfe6ff).into()), + font_style: Some(UserFontStyle::Italic), ..Default::default() }, ), @@ -221,6 +294,20 @@ pub fn ayu() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ + ( + "attribute".into(), + UserHighlightStyle { + color: Some(rgba(0xffb353ff).into()), + ..Default::default() + }, + ), + ( + "boolean".into(), + UserHighlightStyle { + color: Some(rgba(0xd2a6ffff).into()), + ..Default::default() + }, + ), ( "comment".into(), UserHighlightStyle { @@ -230,16 +317,38 @@ pub fn ayu() -> UserThemeFamily { }, ), ( - "something".into(), + "constant".into(), + UserHighlightStyle { + color: Some(rgba(0x95e6cbff).into()), + ..Default::default() + }, + ), + ( + "function".into(), + UserHighlightStyle { + color: Some(rgba(0xffb353ff).into()), + ..Default::default() + }, + ), + ( + "keyword".into(), UserHighlightStyle { color: Some(rgba(0xff8f3fff).into()), ..Default::default() }, ), ( - "punctuation".into(), + "string".into(), UserHighlightStyle { - color: Some(rgba(0xabb5be8c).into()), + color: Some(rgba(0xa9d94bff).into()), + ..Default::default() + }, + ), + ( + "variable".into(), + UserHighlightStyle { + color: Some(rgba(0x38b9e6ff).into()), + font_style: Some(UserFontStyle::Italic), ..Default::default() }, ), diff --git a/crates/theme2/src/themes/dracula.rs b/crates/theme2/src/themes/dracula.rs index 07342b6e6b..f00d1bcaee 100644 --- a/crates/theme2/src/themes/dracula.rs +++ b/crates/theme2/src/themes/dracula.rs @@ -3,9 +3,10 @@ use gpui::rgba; +#[allow(unused)] use crate::{ - Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserHighlightStyle, UserSyntaxTheme, - UserTheme, UserThemeFamily, UserThemeStylesRefinement, + Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserFontStyle, UserFontWeight, + UserHighlightStyle, UserSyntaxTheme, UserTheme, UserThemeFamily, UserThemeStylesRefinement, }; pub fn dracula() -> UserThemeFamily { @@ -66,6 +67,14 @@ pub fn dracula() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ + ( + "attribute".into(), + UserHighlightStyle { + color: Some(rgba(0x50fa7bff).into()), + font_style: Some(UserFontStyle::Italic), + ..Default::default() + }, + ), ( "comment".into(), UserHighlightStyle { @@ -74,19 +83,49 @@ pub fn dracula() -> UserThemeFamily { }, ), ( - "something".into(), + "emphasis".into(), UserHighlightStyle { - color: Some(rgba(0xf8f8f2ff).into()), + font_style: Some(UserFontStyle::Italic), ..Default::default() }, ), ( - "punctuation".into(), + "function".into(), + UserHighlightStyle { + color: Some(rgba(0x50fa7bff).into()), + ..Default::default() + }, + ), + ( + "keyword".into(), UserHighlightStyle { color: Some(rgba(0xff79c6ff).into()), ..Default::default() }, ), + ( + "string".into(), + UserHighlightStyle { + color: Some(rgba(0xf1fa8cff).into()), + ..Default::default() + }, + ), + ( + "type".into(), + UserHighlightStyle { + color: Some(rgba(0x8be9fdff).into()), + font_style: Some(UserFontStyle::Italic), + ..Default::default() + }, + ), + ( + "variable".into(), + UserHighlightStyle { + color: Some(rgba(0xbd93f9ff).into()), + font_style: Some(UserFontStyle::Italic), + ..Default::default() + }, + ), ], }), }, diff --git a/crates/theme2/src/themes/gruvbox.rs b/crates/theme2/src/themes/gruvbox.rs index 453ff7b42a..a9720f8384 100644 --- a/crates/theme2/src/themes/gruvbox.rs +++ b/crates/theme2/src/themes/gruvbox.rs @@ -3,9 +3,10 @@ use gpui::rgba; +#[allow(unused)] use crate::{ - Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserHighlightStyle, UserSyntaxTheme, - UserTheme, UserThemeFamily, UserThemeStylesRefinement, + Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserFontStyle, UserFontWeight, + UserHighlightStyle, UserSyntaxTheme, UserTheme, UserThemeFamily, UserThemeStylesRefinement, }; pub fn gruvbox() -> UserThemeFamily { @@ -64,6 +65,13 @@ pub fn gruvbox() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ + ( + "attribute".into(), + UserHighlightStyle { + color: Some(rgba(0xfabd2eff).into()), + ..Default::default() + }, + ), ( "comment".into(), UserHighlightStyle { @@ -73,16 +81,51 @@ pub fn gruvbox() -> UserThemeFamily { }, ), ( - "something".into(), + "emphasis".into(), UserHighlightStyle { - color: Some(rgba(0x83a598ff).into()), + font_style: Some(UserFontStyle::Italic), + ..Default::default() + }, + ), + ( + "function".into(), + UserHighlightStyle { + color: Some(rgba(0xfabd2eff).into()), + ..Default::default() + }, + ), + ( + "keyword".into(), + UserHighlightStyle { + color: Some(rgba(0xfb4833ff).into()), ..Default::default() }, ), ( "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x83a598ff).into()), + color: Some(rgba(0xa89984ff).into()), + ..Default::default() + }, + ), + ( + "string".into(), + UserHighlightStyle { + color: Some(rgba(0xb8bb25ff).into()), + ..Default::default() + }, + ), + ( + "string.escape".into(), + UserHighlightStyle { + color: Some(rgba(0xfb4833ff).into()), + ..Default::default() + }, + ), + ( + "type".into(), + UserHighlightStyle { + color: Some(rgba(0xfabd2eff).into()), ..Default::default() }, ), @@ -141,6 +184,13 @@ pub fn gruvbox() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ + ( + "attribute".into(), + UserHighlightStyle { + color: Some(rgba(0xfabd2eff).into()), + ..Default::default() + }, + ), ( "comment".into(), UserHighlightStyle { @@ -150,16 +200,51 @@ pub fn gruvbox() -> UserThemeFamily { }, ), ( - "something".into(), + "emphasis".into(), UserHighlightStyle { - color: Some(rgba(0x83a598ff).into()), + font_style: Some(UserFontStyle::Italic), + ..Default::default() + }, + ), + ( + "function".into(), + UserHighlightStyle { + color: Some(rgba(0xfabd2eff).into()), + ..Default::default() + }, + ), + ( + "keyword".into(), + UserHighlightStyle { + color: Some(rgba(0xfb4833ff).into()), ..Default::default() }, ), ( "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x83a598ff).into()), + color: Some(rgba(0xa89984ff).into()), + ..Default::default() + }, + ), + ( + "string".into(), + UserHighlightStyle { + color: Some(rgba(0xb8bb25ff).into()), + ..Default::default() + }, + ), + ( + "string.escape".into(), + UserHighlightStyle { + color: Some(rgba(0xfb4833ff).into()), + ..Default::default() + }, + ), + ( + "type".into(), + UserHighlightStyle { + color: Some(rgba(0xfabd2eff).into()), ..Default::default() }, ), @@ -218,6 +303,13 @@ pub fn gruvbox() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ + ( + "attribute".into(), + UserHighlightStyle { + color: Some(rgba(0xfabd2eff).into()), + ..Default::default() + }, + ), ( "comment".into(), UserHighlightStyle { @@ -227,16 +319,51 @@ pub fn gruvbox() -> UserThemeFamily { }, ), ( - "something".into(), + "emphasis".into(), UserHighlightStyle { - color: Some(rgba(0x83a598ff).into()), + font_style: Some(UserFontStyle::Italic), + ..Default::default() + }, + ), + ( + "function".into(), + UserHighlightStyle { + color: Some(rgba(0xfabd2eff).into()), + ..Default::default() + }, + ), + ( + "keyword".into(), + UserHighlightStyle { + color: Some(rgba(0xfb4833ff).into()), ..Default::default() }, ), ( "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x83a598ff).into()), + color: Some(rgba(0xa89984ff).into()), + ..Default::default() + }, + ), + ( + "string".into(), + UserHighlightStyle { + color: Some(rgba(0xb8bb25ff).into()), + ..Default::default() + }, + ), + ( + "string.escape".into(), + UserHighlightStyle { + color: Some(rgba(0xfb4833ff).into()), + ..Default::default() + }, + ), + ( + "type".into(), + UserHighlightStyle { + color: Some(rgba(0xfabd2eff).into()), ..Default::default() }, ), @@ -295,6 +422,13 @@ pub fn gruvbox() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ + ( + "attribute".into(), + UserHighlightStyle { + color: Some(rgba(0xb57613ff).into()), + ..Default::default() + }, + ), ( "comment".into(), UserHighlightStyle { @@ -304,16 +438,51 @@ pub fn gruvbox() -> UserThemeFamily { }, ), ( - "something".into(), + "emphasis".into(), UserHighlightStyle { - color: Some(rgba(0x066578ff).into()), + font_style: Some(UserFontStyle::Italic), + ..Default::default() + }, + ), + ( + "function".into(), + UserHighlightStyle { + color: Some(rgba(0xb57613ff).into()), + ..Default::default() + }, + ), + ( + "keyword".into(), + UserHighlightStyle { + color: Some(rgba(0x9d0006ff).into()), ..Default::default() }, ), ( "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x066578ff).into()), + color: Some(rgba(0x7c6f64ff).into()), + ..Default::default() + }, + ), + ( + "string".into(), + UserHighlightStyle { + color: Some(rgba(0x79740eff).into()), + ..Default::default() + }, + ), + ( + "string.escape".into(), + UserHighlightStyle { + color: Some(rgba(0x9d0006ff).into()), + ..Default::default() + }, + ), + ( + "type".into(), + UserHighlightStyle { + color: Some(rgba(0xb57613ff).into()), ..Default::default() }, ), @@ -372,6 +541,13 @@ pub fn gruvbox() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ + ( + "attribute".into(), + UserHighlightStyle { + color: Some(rgba(0xb57613ff).into()), + ..Default::default() + }, + ), ( "comment".into(), UserHighlightStyle { @@ -381,16 +557,51 @@ pub fn gruvbox() -> UserThemeFamily { }, ), ( - "something".into(), + "emphasis".into(), UserHighlightStyle { - color: Some(rgba(0x066578ff).into()), + font_style: Some(UserFontStyle::Italic), + ..Default::default() + }, + ), + ( + "function".into(), + UserHighlightStyle { + color: Some(rgba(0xb57613ff).into()), + ..Default::default() + }, + ), + ( + "keyword".into(), + UserHighlightStyle { + color: Some(rgba(0x9d0006ff).into()), ..Default::default() }, ), ( "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x066578ff).into()), + color: Some(rgba(0x7c6f64ff).into()), + ..Default::default() + }, + ), + ( + "string".into(), + UserHighlightStyle { + color: Some(rgba(0x79740eff).into()), + ..Default::default() + }, + ), + ( + "string.escape".into(), + UserHighlightStyle { + color: Some(rgba(0x9d0006ff).into()), + ..Default::default() + }, + ), + ( + "type".into(), + UserHighlightStyle { + color: Some(rgba(0xb57613ff).into()), ..Default::default() }, ), @@ -449,6 +660,13 @@ pub fn gruvbox() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ + ( + "attribute".into(), + UserHighlightStyle { + color: Some(rgba(0xb57613ff).into()), + ..Default::default() + }, + ), ( "comment".into(), UserHighlightStyle { @@ -458,16 +676,51 @@ pub fn gruvbox() -> UserThemeFamily { }, ), ( - "something".into(), + "emphasis".into(), UserHighlightStyle { - color: Some(rgba(0x066578ff).into()), + font_style: Some(UserFontStyle::Italic), + ..Default::default() + }, + ), + ( + "function".into(), + UserHighlightStyle { + color: Some(rgba(0xb57613ff).into()), + ..Default::default() + }, + ), + ( + "keyword".into(), + UserHighlightStyle { + color: Some(rgba(0x9d0006ff).into()), ..Default::default() }, ), ( "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x066578ff).into()), + color: Some(rgba(0x7c6f64ff).into()), + ..Default::default() + }, + ), + ( + "string".into(), + UserHighlightStyle { + color: Some(rgba(0x79740eff).into()), + ..Default::default() + }, + ), + ( + "string.escape".into(), + UserHighlightStyle { + color: Some(rgba(0x9d0006ff).into()), + ..Default::default() + }, + ), + ( + "type".into(), + UserHighlightStyle { + color: Some(rgba(0xb57613ff).into()), ..Default::default() }, ), diff --git a/crates/theme2/src/themes/mod.rs b/crates/theme2/src/themes/mod.rs index c48338b184..4059d3751e 100644 --- a/crates/theme2/src/themes/mod.rs +++ b/crates/theme2/src/themes/mod.rs @@ -6,8 +6,8 @@ mod ayu; mod dracula; mod gruvbox; mod night_owl; +mod noctis; mod nord; -mod notctis; mod palenight; mod rose_pine; mod solarized; @@ -18,8 +18,8 @@ pub use ayu::*; pub use dracula::*; pub use gruvbox::*; pub use night_owl::*; +pub use noctis::*; pub use nord::*; -pub use notctis::*; pub use palenight::*; pub use rose_pine::*; pub use solarized::*; @@ -37,7 +37,7 @@ pub(crate) fn all_user_themes() -> Vec { dracula(), solarized(), nord(), - notctis(), + noctis(), ayu(), gruvbox(), ] diff --git a/crates/theme2/src/themes/night_owl.rs b/crates/theme2/src/themes/night_owl.rs index acebba8bfe..fe7a478ab2 100644 --- a/crates/theme2/src/themes/night_owl.rs +++ b/crates/theme2/src/themes/night_owl.rs @@ -3,9 +3,10 @@ use gpui::rgba; +#[allow(unused)] use crate::{ - Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserHighlightStyle, UserSyntaxTheme, - UserTheme, UserThemeFamily, UserThemeStylesRefinement, + Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserFontStyle, UserFontWeight, + UserHighlightStyle, UserSyntaxTheme, UserTheme, UserThemeFamily, UserThemeStylesRefinement, }; pub fn night_owl() -> UserThemeFamily { @@ -65,6 +66,21 @@ pub fn night_owl() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ + ( + "attribute".into(), + UserHighlightStyle { + color: Some(rgba(0xc5e478ff).into()), + font_style: Some(UserFontStyle::Italic), + ..Default::default() + }, + ), + ( + "boolean".into(), + UserHighlightStyle { + color: Some(rgba(0x82aaffff).into()), + ..Default::default() + }, + ), ( "comment".into(), UserHighlightStyle { @@ -74,16 +90,39 @@ pub fn night_owl() -> UserThemeFamily { }, ), ( - "something".into(), + "constant".into(), UserHighlightStyle { - color: Some(rgba(0x7fcac3ff).into()), + color: Some(rgba(0x82aaffff).into()), ..Default::default() }, ), ( - "punctuation".into(), + "function".into(), UserHighlightStyle { - color: Some(rgba(0xd3413dff).into()), + color: Some(rgba(0xc792eaff).into()), + font_style: Some(UserFontStyle::Italic), + ..Default::default() + }, + ), + ( + "keyword".into(), + UserHighlightStyle { + color: Some(rgba(0xc792eaff).into()), + font_style: Some(UserFontStyle::Italic), + ..Default::default() + }, + ), + ( + "string".into(), + UserHighlightStyle { + color: Some(rgba(0xecc48dff).into()), + ..Default::default() + }, + ), + ( + "variable".into(), + UserHighlightStyle { + color: Some(rgba(0x7fdbcaff).into()), ..Default::default() }, ), @@ -144,6 +183,21 @@ pub fn night_owl() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ + ( + "attribute".into(), + UserHighlightStyle { + color: Some(rgba(0x4876d6ff).into()), + font_style: Some(UserFontStyle::Italic), + ..Default::default() + }, + ), + ( + "boolean".into(), + UserHighlightStyle { + color: Some(rgba(0x4876d6ff).into()), + ..Default::default() + }, + ), ( "comment".into(), UserHighlightStyle { @@ -153,16 +207,39 @@ pub fn night_owl() -> UserThemeFamily { }, ), ( - "something".into(), + "constant".into(), UserHighlightStyle { - color: Some(rgba(0x0b969bff).into()), + color: Some(rgba(0x4876d6ff).into()), ..Default::default() }, ), ( - "punctuation".into(), + "function".into(), UserHighlightStyle { - color: Some(rgba(0xd3413dff).into()), + color: Some(rgba(0x994bc3ff).into()), + font_style: Some(UserFontStyle::Italic), + ..Default::default() + }, + ), + ( + "keyword".into(), + UserHighlightStyle { + color: Some(rgba(0x994bc3ff).into()), + font_style: Some(UserFontStyle::Italic), + ..Default::default() + }, + ), + ( + "string".into(), + UserHighlightStyle { + color: Some(rgba(0x4876d6ff).into()), + ..Default::default() + }, + ), + ( + "variable".into(), + UserHighlightStyle { + color: Some(rgba(0x0b969bff).into()), ..Default::default() }, ), diff --git a/crates/theme2/src/themes/notctis.rs b/crates/theme2/src/themes/noctis.rs similarity index 71% rename from crates/theme2/src/themes/notctis.rs rename to crates/theme2/src/themes/noctis.rs index ec4ca8527e..bcedb121c7 100644 --- a/crates/theme2/src/themes/notctis.rs +++ b/crates/theme2/src/themes/noctis.rs @@ -3,14 +3,15 @@ use gpui::rgba; +#[allow(unused)] use crate::{ - Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserHighlightStyle, UserSyntaxTheme, - UserTheme, UserThemeFamily, UserThemeStylesRefinement, + Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserFontStyle, UserFontWeight, + UserHighlightStyle, UserSyntaxTheme, UserTheme, UserThemeFamily, UserThemeStylesRefinement, }; -pub fn notctis() -> UserThemeFamily { +pub fn noctis() -> UserThemeFamily { UserThemeFamily { - name: "Notctis".into(), + name: "Noctis".into(), author: "Liviu Schera (liviuschera)".into(), themes: vec![ UserTheme { @@ -67,6 +68,13 @@ pub fn notctis() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ + ( + "boolean".into(), + UserHighlightStyle { + color: Some(rgba(0x705febff).into()), + ..Default::default() + }, + ), ( "comment".into(), UserHighlightStyle { @@ -75,19 +83,47 @@ pub fn notctis() -> UserThemeFamily { }, ), ( - "punctuation".into(), + "constant".into(), UserHighlightStyle { - color: Some(rgba(0x49ace9ff).into()), + color: Some(rgba(0xbecfdaff).into()), ..Default::default() }, ), ( - "something".into(), + "constructor".into(), + UserHighlightStyle { + font_weight: Some(UserFontWeight(700.0)), + ..Default::default() + }, + ), + ( + "function".into(), + UserHighlightStyle { + color: Some(rgba(0x15a2b6ff).into()), + ..Default::default() + }, + ), + ( + "keyword".into(), + UserHighlightStyle { + color: Some(rgba(0xdf759aff).into()), + ..Default::default() + }, + ), + ( + "string".into(), UserHighlightStyle { color: Some(rgba(0x49e9a6ff).into()), ..Default::default() }, ), + ( + "variable".into(), + UserHighlightStyle { + color: Some(rgba(0xe66432ff).into()), + ..Default::default() + }, + ), ], }), }, @@ -146,6 +182,13 @@ pub fn notctis() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ + ( + "boolean".into(), + UserHighlightStyle { + color: Some(rgba(0x705febff).into()), + ..Default::default() + }, + ), ( "comment".into(), UserHighlightStyle { @@ -154,19 +197,47 @@ pub fn notctis() -> UserThemeFamily { }, ), ( - "punctuation".into(), + "constant".into(), UserHighlightStyle { - color: Some(rgba(0x49ace9ff).into()), + color: Some(rgba(0xcbbec2ff).into()), ..Default::default() }, ), ( - "something".into(), + "constructor".into(), + UserHighlightStyle { + font_weight: Some(UserFontWeight(700.0)), + ..Default::default() + }, + ), + ( + "function".into(), + UserHighlightStyle { + color: Some(rgba(0x15a2b6ff).into()), + ..Default::default() + }, + ), + ( + "keyword".into(), + UserHighlightStyle { + color: Some(rgba(0xdf759aff).into()), + ..Default::default() + }, + ), + ( + "string".into(), UserHighlightStyle { color: Some(rgba(0x49e9a6ff).into()), ..Default::default() }, ), + ( + "variable".into(), + UserHighlightStyle { + color: Some(rgba(0xe66432ff).into()), + ..Default::default() + }, + ), ], }), }, @@ -225,6 +296,13 @@ pub fn notctis() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ + ( + "boolean".into(), + UserHighlightStyle { + color: Some(rgba(0x5841ffff).into()), + ..Default::default() + }, + ), ( "comment".into(), UserHighlightStyle { @@ -233,19 +311,47 @@ pub fn notctis() -> UserThemeFamily { }, ), ( - "punctuation".into(), + "constant".into(), UserHighlightStyle { - color: Some(rgba(0x0094f0ff).into()), + color: Some(rgba(0x004d57ff).into()), ..Default::default() }, ), ( - "something".into(), + "constructor".into(), + UserHighlightStyle { + font_weight: Some(UserFontWeight(700.0)), + ..Default::default() + }, + ), + ( + "function".into(), + UserHighlightStyle { + color: Some(rgba(0x0094a8ff).into()), + ..Default::default() + }, + ), + ( + "keyword".into(), + UserHighlightStyle { + color: Some(rgba(0xff5792ff).into()), + ..Default::default() + }, + ), + ( + "string".into(), UserHighlightStyle { color: Some(rgba(0x00b368ff).into()), ..Default::default() }, ), + ( + "variable".into(), + UserHighlightStyle { + color: Some(rgba(0xe64100ff).into()), + ..Default::default() + }, + ), ], }), }, @@ -304,6 +410,13 @@ pub fn notctis() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ + ( + "boolean".into(), + UserHighlightStyle { + color: Some(rgba(0x5841ffff).into()), + ..Default::default() + }, + ), ( "comment".into(), UserHighlightStyle { @@ -312,19 +425,47 @@ pub fn notctis() -> UserThemeFamily { }, ), ( - "punctuation".into(), + "constant".into(), UserHighlightStyle { - color: Some(rgba(0x0094f0ff).into()), + color: Some(rgba(0x0c006bff).into()), ..Default::default() }, ), ( - "something".into(), + "constructor".into(), + UserHighlightStyle { + font_weight: Some(UserFontWeight(700.0)), + ..Default::default() + }, + ), + ( + "function".into(), + UserHighlightStyle { + color: Some(rgba(0x0094a8ff).into()), + ..Default::default() + }, + ), + ( + "keyword".into(), + UserHighlightStyle { + color: Some(rgba(0xff5792ff).into()), + ..Default::default() + }, + ), + ( + "string".into(), UserHighlightStyle { color: Some(rgba(0x00b368ff).into()), ..Default::default() }, ), + ( + "variable".into(), + UserHighlightStyle { + color: Some(rgba(0xe64100ff).into()), + ..Default::default() + }, + ), ], }), }, @@ -383,6 +524,13 @@ pub fn notctis() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ + ( + "boolean".into(), + UserHighlightStyle { + color: Some(rgba(0x5841ffff).into()), + ..Default::default() + }, + ), ( "comment".into(), UserHighlightStyle { @@ -391,19 +539,47 @@ pub fn notctis() -> UserThemeFamily { }, ), ( - "punctuation".into(), + "constant".into(), UserHighlightStyle { - color: Some(rgba(0x0094f0ff).into()), + color: Some(rgba(0x004d57ff).into()), ..Default::default() }, ), ( - "something".into(), + "constructor".into(), + UserHighlightStyle { + font_weight: Some(UserFontWeight(700.0)), + ..Default::default() + }, + ), + ( + "function".into(), + UserHighlightStyle { + color: Some(rgba(0x0094a8ff).into()), + ..Default::default() + }, + ), + ( + "keyword".into(), + UserHighlightStyle { + color: Some(rgba(0xff5792ff).into()), + ..Default::default() + }, + ), + ( + "string".into(), UserHighlightStyle { color: Some(rgba(0x00b368ff).into()), ..Default::default() }, ), + ( + "variable".into(), + UserHighlightStyle { + color: Some(rgba(0xe64100ff).into()), + ..Default::default() + }, + ), ], }), }, @@ -462,6 +638,13 @@ pub fn notctis() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ + ( + "boolean".into(), + UserHighlightStyle { + color: Some(rgba(0x7067b1ff).into()), + ..Default::default() + }, + ), ( "comment".into(), UserHighlightStyle { @@ -470,19 +653,47 @@ pub fn notctis() -> UserThemeFamily { }, ), ( - "punctuation".into(), + "constant".into(), UserHighlightStyle { - color: Some(rgba(0x5897bfff).into()), + color: Some(rgba(0xc5cdd3ff).into()), ..Default::default() }, ), ( - "something".into(), + "constructor".into(), + UserHighlightStyle { + font_weight: Some(UserFontWeight(700.0)), + ..Default::default() + }, + ), + ( + "function".into(), + UserHighlightStyle { + color: Some(rgba(0x3e848dff).into()), + ..Default::default() + }, + ), + ( + "keyword".into(), + UserHighlightStyle { + color: Some(rgba(0xc88da2ff).into()), + ..Default::default() + }, + ), + ( + "string".into(), UserHighlightStyle { color: Some(rgba(0x72c09fff).into()), ..Default::default() }, ), + ( + "variable".into(), + UserHighlightStyle { + color: Some(rgba(0xc37455ff).into()), + ..Default::default() + }, + ), ], }), }, @@ -541,6 +752,13 @@ pub fn notctis() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ + ( + "boolean".into(), + UserHighlightStyle { + color: Some(rgba(0x705febff).into()), + ..Default::default() + }, + ), ( "comment".into(), UserHighlightStyle { @@ -549,19 +767,47 @@ pub fn notctis() -> UserThemeFamily { }, ), ( - "punctuation".into(), + "constant".into(), UserHighlightStyle { - color: Some(rgba(0x49ace9ff).into()), + color: Some(rgba(0xb1c9ccff).into()), ..Default::default() }, ), ( - "something".into(), + "constructor".into(), + UserHighlightStyle { + font_weight: Some(UserFontWeight(700.0)), + ..Default::default() + }, + ), + ( + "function".into(), + UserHighlightStyle { + color: Some(rgba(0x15a2b6ff).into()), + ..Default::default() + }, + ), + ( + "keyword".into(), + UserHighlightStyle { + color: Some(rgba(0xdf759aff).into()), + ..Default::default() + }, + ), + ( + "string".into(), UserHighlightStyle { color: Some(rgba(0x49e9a6ff).into()), ..Default::default() }, ), + ( + "variable".into(), + UserHighlightStyle { + color: Some(rgba(0xe66432ff).into()), + ..Default::default() + }, + ), ], }), }, @@ -620,6 +866,13 @@ pub fn notctis() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ + ( + "boolean".into(), + UserHighlightStyle { + color: Some(rgba(0x705febff).into()), + ..Default::default() + }, + ), ( "comment".into(), UserHighlightStyle { @@ -628,19 +881,47 @@ pub fn notctis() -> UserThemeFamily { }, ), ( - "punctuation".into(), + "constant".into(), UserHighlightStyle { - color: Some(rgba(0x49ace9ff).into()), + color: Some(rgba(0xb1c9ccff).into()), ..Default::default() }, ), ( - "something".into(), + "constructor".into(), + UserHighlightStyle { + font_weight: Some(UserFontWeight(700.0)), + ..Default::default() + }, + ), + ( + "function".into(), + UserHighlightStyle { + color: Some(rgba(0x15a2b6ff).into()), + ..Default::default() + }, + ), + ( + "keyword".into(), + UserHighlightStyle { + color: Some(rgba(0xdf759aff).into()), + ..Default::default() + }, + ), + ( + "string".into(), UserHighlightStyle { color: Some(rgba(0x49e9a6ff).into()), ..Default::default() }, ), + ( + "variable".into(), + UserHighlightStyle { + color: Some(rgba(0xe66432ff).into()), + ..Default::default() + }, + ), ], }), }, @@ -699,6 +980,13 @@ pub fn notctis() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ + ( + "boolean".into(), + UserHighlightStyle { + color: Some(rgba(0x705febff).into()), + ..Default::default() + }, + ), ( "comment".into(), UserHighlightStyle { @@ -707,19 +995,47 @@ pub fn notctis() -> UserThemeFamily { }, ), ( - "punctuation".into(), + "constant".into(), UserHighlightStyle { - color: Some(rgba(0x49ace9ff).into()), + color: Some(rgba(0xb1c9ccff).into()), ..Default::default() }, ), ( - "something".into(), + "constructor".into(), + UserHighlightStyle { + font_weight: Some(UserFontWeight(700.0)), + ..Default::default() + }, + ), + ( + "function".into(), + UserHighlightStyle { + color: Some(rgba(0x15a2b6ff).into()), + ..Default::default() + }, + ), + ( + "keyword".into(), + UserHighlightStyle { + color: Some(rgba(0xdf759aff).into()), + ..Default::default() + }, + ), + ( + "string".into(), UserHighlightStyle { color: Some(rgba(0x49e9a6ff).into()), ..Default::default() }, ), + ( + "variable".into(), + UserHighlightStyle { + color: Some(rgba(0xe66432ff).into()), + ..Default::default() + }, + ), ], }), }, @@ -778,6 +1094,13 @@ pub fn notctis() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ + ( + "boolean".into(), + UserHighlightStyle { + color: Some(rgba(0x705febff).into()), + ..Default::default() + }, + ), ( "comment".into(), UserHighlightStyle { @@ -786,19 +1109,47 @@ pub fn notctis() -> UserThemeFamily { }, ), ( - "punctuation".into(), + "constant".into(), UserHighlightStyle { - color: Some(rgba(0x49ace9ff).into()), + color: Some(rgba(0xc5c2d6ff).into()), ..Default::default() }, ), ( - "something".into(), + "constructor".into(), + UserHighlightStyle { + font_weight: Some(UserFontWeight(700.0)), + ..Default::default() + }, + ), + ( + "function".into(), + UserHighlightStyle { + color: Some(rgba(0x15a2b6ff).into()), + ..Default::default() + }, + ), + ( + "keyword".into(), + UserHighlightStyle { + color: Some(rgba(0xdf759aff).into()), + ..Default::default() + }, + ), + ( + "string".into(), UserHighlightStyle { color: Some(rgba(0x49e9a6ff).into()), ..Default::default() }, ), + ( + "variable".into(), + UserHighlightStyle { + color: Some(rgba(0xe66432ff).into()), + ..Default::default() + }, + ), ], }), }, @@ -857,6 +1208,13 @@ pub fn notctis() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ + ( + "boolean".into(), + UserHighlightStyle { + color: Some(rgba(0x705febff).into()), + ..Default::default() + }, + ), ( "comment".into(), UserHighlightStyle { @@ -865,19 +1223,47 @@ pub fn notctis() -> UserThemeFamily { }, ), ( - "punctuation".into(), + "constant".into(), UserHighlightStyle { - color: Some(rgba(0x49ace9ff).into()), + color: Some(rgba(0xccbfd9ff).into()), ..Default::default() }, ), ( - "something".into(), + "constructor".into(), + UserHighlightStyle { + font_weight: Some(UserFontWeight(700.0)), + ..Default::default() + }, + ), + ( + "function".into(), + UserHighlightStyle { + color: Some(rgba(0x15a2b6ff).into()), + ..Default::default() + }, + ), + ( + "keyword".into(), + UserHighlightStyle { + color: Some(rgba(0xdf759aff).into()), + ..Default::default() + }, + ), + ( + "string".into(), UserHighlightStyle { color: Some(rgba(0x49e9a6ff).into()), ..Default::default() }, ), + ( + "variable".into(), + UserHighlightStyle { + color: Some(rgba(0xe66432ff).into()), + ..Default::default() + }, + ), ], }), }, diff --git a/crates/theme2/src/themes/nord.rs b/crates/theme2/src/themes/nord.rs index 4069fb3063..423725a457 100644 --- a/crates/theme2/src/themes/nord.rs +++ b/crates/theme2/src/themes/nord.rs @@ -3,9 +3,10 @@ use gpui::rgba; +#[allow(unused)] use crate::{ - Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserHighlightStyle, UserSyntaxTheme, - UserTheme, UserThemeFamily, UserThemeStylesRefinement, + Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserFontStyle, UserFontWeight, + UserHighlightStyle, UserSyntaxTheme, UserTheme, UserThemeFamily, UserThemeStylesRefinement, }; pub fn nord() -> UserThemeFamily { @@ -66,6 +67,20 @@ pub fn nord() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ + ( + "attribute".into(), + UserHighlightStyle { + color: Some(rgba(0x8fbcbbff).into()), + ..Default::default() + }, + ), + ( + "boolean".into(), + UserHighlightStyle { + color: Some(rgba(0x81a1c1ff).into()), + ..Default::default() + }, + ), ( "comment".into(), UserHighlightStyle { @@ -74,19 +89,54 @@ pub fn nord() -> UserThemeFamily { }, ), ( - "punctuation".into(), + "constant".into(), + UserHighlightStyle { + color: Some(rgba(0xebcb8bff).into()), + ..Default::default() + }, + ), + ( + "emphasis".into(), + UserHighlightStyle { + font_style: Some(UserFontStyle::Italic), + ..Default::default() + }, + ), + ( + "function".into(), + UserHighlightStyle { + color: Some(rgba(0x88bfd0ff).into()), + ..Default::default() + }, + ), + ( + "keyword".into(), UserHighlightStyle { color: Some(rgba(0x81a1c1ff).into()), ..Default::default() }, ), ( - "something".into(), + "punctuation".into(), + UserHighlightStyle { + color: Some(rgba(0xeceff4ff).into()), + ..Default::default() + }, + ), + ( + "string".into(), UserHighlightStyle { color: Some(rgba(0xa3be8cff).into()), ..Default::default() }, ), + ( + "variable".into(), + UserHighlightStyle { + color: Some(rgba(0x81a1c1ff).into()), + ..Default::default() + }, + ), ], }), }, diff --git a/crates/theme2/src/themes/palenight.rs b/crates/theme2/src/themes/palenight.rs index 1266828ac0..8f641dce0a 100644 --- a/crates/theme2/src/themes/palenight.rs +++ b/crates/theme2/src/themes/palenight.rs @@ -3,9 +3,10 @@ use gpui::rgba; +#[allow(unused)] use crate::{ - Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserHighlightStyle, UserSyntaxTheme, - UserTheme, UserThemeFamily, UserThemeStylesRefinement, + Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserFontStyle, UserFontWeight, + UserHighlightStyle, UserSyntaxTheme, UserTheme, UserThemeFamily, UserThemeStylesRefinement, }; pub fn palenight() -> UserThemeFamily { @@ -65,6 +66,20 @@ pub fn palenight() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ + ( + "attribute".into(), + UserHighlightStyle { + color: Some(rgba(0xffcb6bff).into()), + ..Default::default() + }, + ), + ( + "boolean".into(), + UserHighlightStyle { + color: Some(rgba(0x82aaffff).into()), + ..Default::default() + }, + ), ( "comment".into(), UserHighlightStyle { @@ -74,16 +89,37 @@ pub fn palenight() -> UserThemeFamily { }, ), ( - "something".into(), + "constant".into(), UserHighlightStyle { - color: Some(rgba(0x7fcac3ff).into()), + color: Some(rgba(0x82aaffff).into()), ..Default::default() }, ), ( - "punctuation".into(), + "function".into(), UserHighlightStyle { - color: Some(rgba(0xd3413dff).into()), + color: Some(rgba(0x82aaffff).into()), + ..Default::default() + }, + ), + ( + "keyword".into(), + UserHighlightStyle { + color: Some(rgba(0xc792eaff).into()), + ..Default::default() + }, + ), + ( + "string".into(), + UserHighlightStyle { + color: Some(rgba(0xc3e88dff).into()), + ..Default::default() + }, + ), + ( + "variable".into(), + UserHighlightStyle { + color: Some(rgba(0xff5571ff).into()), ..Default::default() }, ), @@ -143,6 +179,20 @@ pub fn palenight() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ + ( + "attribute".into(), + UserHighlightStyle { + color: Some(rgba(0xffcb6bff).into()), + ..Default::default() + }, + ), + ( + "boolean".into(), + UserHighlightStyle { + color: Some(rgba(0x82aaffff).into()), + ..Default::default() + }, + ), ( "comment".into(), UserHighlightStyle { @@ -152,16 +202,37 @@ pub fn palenight() -> UserThemeFamily { }, ), ( - "something".into(), + "constant".into(), UserHighlightStyle { - color: Some(rgba(0x7fcac3ff).into()), + color: Some(rgba(0x82aaffff).into()), ..Default::default() }, ), ( - "punctuation".into(), + "function".into(), UserHighlightStyle { - color: Some(rgba(0xd3413dff).into()), + color: Some(rgba(0x82aaffff).into()), + ..Default::default() + }, + ), + ( + "keyword".into(), + UserHighlightStyle { + color: Some(rgba(0xc792eaff).into()), + ..Default::default() + }, + ), + ( + "string".into(), + UserHighlightStyle { + color: Some(rgba(0xc3e88dff).into()), + ..Default::default() + }, + ), + ( + "variable".into(), + UserHighlightStyle { + color: Some(rgba(0xff5571ff).into()), ..Default::default() }, ), @@ -221,6 +292,20 @@ pub fn palenight() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ + ( + "attribute".into(), + UserHighlightStyle { + color: Some(rgba(0xffcb6bff).into()), + ..Default::default() + }, + ), + ( + "boolean".into(), + UserHighlightStyle { + color: Some(rgba(0x82aaffff).into()), + ..Default::default() + }, + ), ( "comment".into(), UserHighlightStyle { @@ -230,16 +315,37 @@ pub fn palenight() -> UserThemeFamily { }, ), ( - "something".into(), + "constant".into(), UserHighlightStyle { - color: Some(rgba(0x7fcac3ff).into()), + color: Some(rgba(0x82aaffff).into()), ..Default::default() }, ), ( - "punctuation".into(), + "function".into(), UserHighlightStyle { - color: Some(rgba(0xd3413dff).into()), + color: Some(rgba(0x82aaffff).into()), + ..Default::default() + }, + ), + ( + "keyword".into(), + UserHighlightStyle { + color: Some(rgba(0xc792eaff).into()), + ..Default::default() + }, + ), + ( + "string".into(), + UserHighlightStyle { + color: Some(rgba(0xc3e88dff).into()), + ..Default::default() + }, + ), + ( + "variable".into(), + UserHighlightStyle { + color: Some(rgba(0xff5571ff).into()), ..Default::default() }, ), diff --git a/crates/theme2/src/themes/rose_pine.rs b/crates/theme2/src/themes/rose_pine.rs index 475c023b01..275fe575bd 100644 --- a/crates/theme2/src/themes/rose_pine.rs +++ b/crates/theme2/src/themes/rose_pine.rs @@ -3,9 +3,10 @@ use gpui::rgba; +#[allow(unused)] use crate::{ - Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserHighlightStyle, UserSyntaxTheme, - UserTheme, UserThemeFamily, UserThemeStylesRefinement, + Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserFontStyle, UserFontWeight, + UserHighlightStyle, UserSyntaxTheme, UserTheme, UserThemeFamily, UserThemeStylesRefinement, }; pub fn rose_pine() -> UserThemeFamily { @@ -66,6 +67,21 @@ pub fn rose_pine() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ + ( + "attribute".into(), + UserHighlightStyle { + color: Some(rgba(0xc4a7e7ff).into()), + font_style: Some(UserFontStyle::Italic), + ..Default::default() + }, + ), + ( + "boolean".into(), + UserHighlightStyle { + color: Some(rgba(0xebbcbaff).into()), + ..Default::default() + }, + ), ( "comment".into(), UserHighlightStyle { @@ -75,17 +91,37 @@ pub fn rose_pine() -> UserThemeFamily { }, ), ( - "something".into(), + "keyword".into(), UserHighlightStyle { - color: Some(rgba(0xebbcbaff).into()), - font_style: Some(UserFontStyle::Italic), + color: Some(rgba(0x30738fff).into()), ..Default::default() }, ), ( "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x6e6a86ff).into()), + color: Some(rgba(0x908caaff).into()), + ..Default::default() + }, + ), + ( + "string".into(), + UserHighlightStyle { + color: Some(rgba(0xf5c177ff).into()), + ..Default::default() + }, + ), + ( + "type".into(), + UserHighlightStyle { + color: Some(rgba(0x9ccfd8ff).into()), + ..Default::default() + }, + ), + ( + "variable".into(), + UserHighlightStyle { + color: Some(rgba(0xe0def4ff).into()), ..Default::default() }, ), @@ -146,6 +182,21 @@ pub fn rose_pine() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ + ( + "attribute".into(), + UserHighlightStyle { + color: Some(rgba(0xc4a7e7ff).into()), + font_style: Some(UserFontStyle::Italic), + ..Default::default() + }, + ), + ( + "boolean".into(), + UserHighlightStyle { + color: Some(rgba(0xea9a97ff).into()), + ..Default::default() + }, + ), ( "comment".into(), UserHighlightStyle { @@ -155,17 +206,37 @@ pub fn rose_pine() -> UserThemeFamily { }, ), ( - "something".into(), + "keyword".into(), UserHighlightStyle { - color: Some(rgba(0xea9a97ff).into()), - font_style: Some(UserFontStyle::Italic), + color: Some(rgba(0x3d8fb0ff).into()), ..Default::default() }, ), ( "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x6e6a86ff).into()), + color: Some(rgba(0x908caaff).into()), + ..Default::default() + }, + ), + ( + "string".into(), + UserHighlightStyle { + color: Some(rgba(0xf5c177ff).into()), + ..Default::default() + }, + ), + ( + "type".into(), + UserHighlightStyle { + color: Some(rgba(0x9ccfd8ff).into()), + ..Default::default() + }, + ), + ( + "variable".into(), + UserHighlightStyle { + color: Some(rgba(0xe0def4ff).into()), ..Default::default() }, ), @@ -226,6 +297,21 @@ pub fn rose_pine() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ + ( + "attribute".into(), + UserHighlightStyle { + color: Some(rgba(0x9079a9ff).into()), + font_style: Some(UserFontStyle::Italic), + ..Default::default() + }, + ), + ( + "boolean".into(), + UserHighlightStyle { + color: Some(rgba(0xd7827dff).into()), + ..Default::default() + }, + ), ( "comment".into(), UserHighlightStyle { @@ -235,17 +321,37 @@ pub fn rose_pine() -> UserThemeFamily { }, ), ( - "something".into(), + "keyword".into(), UserHighlightStyle { - color: Some(rgba(0xd7827dff).into()), - font_style: Some(UserFontStyle::Italic), + color: Some(rgba(0x276983ff).into()), ..Default::default() }, ), ( "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x9893a5ff).into()), + color: Some(rgba(0x797593ff).into()), + ..Default::default() + }, + ), + ( + "string".into(), + UserHighlightStyle { + color: Some(rgba(0xea9d34ff).into()), + ..Default::default() + }, + ), + ( + "type".into(), + UserHighlightStyle { + color: Some(rgba(0x55949fff).into()), + ..Default::default() + }, + ), + ( + "variable".into(), + UserHighlightStyle { + color: Some(rgba(0x575279ff).into()), ..Default::default() }, ), diff --git a/crates/theme2/src/themes/solarized.rs b/crates/theme2/src/themes/solarized.rs index ebacffaaa2..ad986fde5c 100644 --- a/crates/theme2/src/themes/solarized.rs +++ b/crates/theme2/src/themes/solarized.rs @@ -3,9 +3,10 @@ use gpui::rgba; +#[allow(unused)] use crate::{ - Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserHighlightStyle, UserSyntaxTheme, - UserTheme, UserThemeFamily, UserThemeStylesRefinement, + Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserFontStyle, UserFontWeight, + UserHighlightStyle, UserSyntaxTheme, UserTheme, UserThemeFamily, UserThemeStylesRefinement, }; pub fn solarized() -> UserThemeFamily { @@ -61,6 +62,20 @@ pub fn solarized() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ + ( + "attribute".into(), + UserHighlightStyle { + color: Some(rgba(0x93a1a1ff).into()), + ..Default::default() + }, + ), + ( + "boolean".into(), + UserHighlightStyle { + color: Some(rgba(0xb58800ff).into()), + ..Default::default() + }, + ), ( "comment".into(), UserHighlightStyle { @@ -70,17 +85,51 @@ pub fn solarized() -> UserThemeFamily { }, ), ( - "something".into(), + "constant".into(), UserHighlightStyle { - color: Some(rgba(0x93a1a1ff).into()), - font_weight: Some(UserFontWeight(700.0)), + color: Some(rgba(0xcb4b15ff).into()), ..Default::default() }, ), ( - "punctuation".into(), + "function".into(), UserHighlightStyle { - color: Some(rgba(0x657b83ff).into()), + color: Some(rgba(0x258ad2ff).into()), + ..Default::default() + }, + ), + ( + "keyword".into(), + UserHighlightStyle { + color: Some(rgba(0x859900ff).into()), + ..Default::default() + }, + ), + ( + "property".into(), + UserHighlightStyle { + color: Some(rgba(0x839496ff).into()), + ..Default::default() + }, + ), + ( + "string".into(), + UserHighlightStyle { + color: Some(rgba(0x29a198ff).into()), + ..Default::default() + }, + ), + ( + "type".into(), + UserHighlightStyle { + color: Some(rgba(0xcb4b15ff).into()), + ..Default::default() + }, + ), + ( + "variable".into(), + UserHighlightStyle { + color: Some(rgba(0x258ad2ff).into()), ..Default::default() }, ), @@ -133,6 +182,20 @@ pub fn solarized() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ + ( + "attribute".into(), + UserHighlightStyle { + color: Some(rgba(0x93a1a1ff).into()), + ..Default::default() + }, + ), + ( + "boolean".into(), + UserHighlightStyle { + color: Some(rgba(0xb58800ff).into()), + ..Default::default() + }, + ), ( "comment".into(), UserHighlightStyle { @@ -142,16 +205,44 @@ pub fn solarized() -> UserThemeFamily { }, ), ( - "something".into(), + "constant".into(), UserHighlightStyle { - color: Some(rgba(0x657b83ff).into()), + color: Some(rgba(0xcb4b15ff).into()), ..Default::default() }, ), ( - "punctuation".into(), + "function".into(), UserHighlightStyle { - color: Some(rgba(0x93a1a1ff).into()), + color: Some(rgba(0x258ad2ff).into()), + ..Default::default() + }, + ), + ( + "keyword".into(), + UserHighlightStyle { + color: Some(rgba(0x859900ff).into()), + ..Default::default() + }, + ), + ( + "string".into(), + UserHighlightStyle { + color: Some(rgba(0x29a198ff).into()), + ..Default::default() + }, + ), + ( + "type".into(), + UserHighlightStyle { + color: Some(rgba(0x258ad2ff).into()), + ..Default::default() + }, + ), + ( + "variable".into(), + UserHighlightStyle { + color: Some(rgba(0x258ad2ff).into()), ..Default::default() }, ), diff --git a/crates/theme2/src/themes/synthwave_84.rs b/crates/theme2/src/themes/synthwave_84.rs index 18c734c743..77686a18c6 100644 --- a/crates/theme2/src/themes/synthwave_84.rs +++ b/crates/theme2/src/themes/synthwave_84.rs @@ -3,9 +3,10 @@ use gpui::rgba; +#[allow(unused)] use crate::{ - Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserHighlightStyle, UserSyntaxTheme, - UserTheme, UserThemeFamily, UserThemeStylesRefinement, + Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserFontStyle, UserFontWeight, + UserHighlightStyle, UserSyntaxTheme, UserTheme, UserThemeFamily, UserThemeStylesRefinement, }; pub fn synthwave_84() -> UserThemeFamily { @@ -51,6 +52,20 @@ pub fn synthwave_84() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ + ( + "attribute".into(), + UserHighlightStyle { + color: Some(rgba(0xfede5cff).into()), + ..Default::default() + }, + ), + ( + "boolean".into(), + UserHighlightStyle { + color: Some(rgba(0xf97d71ff).into()), + ..Default::default() + }, + ), ( "comment".into(), UserHighlightStyle { @@ -60,16 +75,31 @@ pub fn synthwave_84() -> UserThemeFamily { }, ), ( - "something".into(), + "function".into(), + UserHighlightStyle { + color: Some(rgba(0x35f9f5ff).into()), + ..Default::default() + }, + ), + ( + "keyword".into(), + UserHighlightStyle { + color: Some(rgba(0xfede5cff).into()), + ..Default::default() + }, + ), + ( + "type".into(), UserHighlightStyle { color: Some(rgba(0xfe444fff).into()), ..Default::default() }, ), ( - "punctuation".into(), + "variable".into(), UserHighlightStyle { - color: Some(rgba(0xfede5cff).into()), + color: Some(rgba(0xfe444fff).into()), + font_weight: Some(UserFontWeight(700.0)), ..Default::default() }, ), diff --git a/crates/theme2/src/user_theme.rs b/crates/theme2/src/user_theme.rs index a1f7d4fd79..b1f689416d 100644 --- a/crates/theme2/src/user_theme.rs +++ b/crates/theme2/src/user_theme.rs @@ -1,4 +1,4 @@ -use gpui::{FontWeight, Hsla}; +use gpui::{FontStyle, FontWeight, Hsla}; use refineable::Refineable; use serde::Deserialize; @@ -40,7 +40,7 @@ pub struct UserHighlightStyle { pub font_weight: Option, } -#[derive(Clone, Default, Deserialize)] +#[derive(Clone, Copy, Default, Deserialize)] pub struct UserFontWeight(pub f32); impl UserFontWeight { @@ -64,6 +64,12 @@ impl UserFontWeight { pub const BLACK: Self = Self(FontWeight::BLACK.0); } +impl From for FontWeight { + fn from(value: UserFontWeight) -> Self { + Self(value.0) + } +} + #[derive(Debug, Clone, Copy, Deserialize)] pub enum UserFontStyle { Normal, @@ -71,8 +77,18 @@ pub enum UserFontStyle { Oblique, } -impl UserHighlightStyle { - pub fn is_empty(&self) -> bool { - self.color.is_none() +impl From for FontStyle { + fn from(value: UserFontStyle) -> Self { + match value { + UserFontStyle::Normal => FontStyle::Normal, + UserFontStyle::Italic => FontStyle::Italic, + UserFontStyle::Oblique => FontStyle::Oblique, + } + } +} + +impl UserHighlightStyle { + pub fn is_empty(&self) -> bool { + self.color.is_none() && self.font_style.is_none() && self.font_weight.is_none() } } diff --git a/crates/theme_importer/Cargo.toml b/crates/theme_importer/Cargo.toml index 28ae305735..306cea8ecb 100644 --- a/crates/theme_importer/Cargo.toml +++ b/crates/theme_importer/Cargo.toml @@ -15,5 +15,6 @@ log.workspace = true rust-embed.workspace = true serde.workspace = true simplelog = "0.9" +strum = { version = "0.25.0", features = ["derive"] } theme = { package = "theme2", path = "../theme2", features = ["importing-themes"] } uuid.workspace = true diff --git a/crates/theme_importer/src/main.rs b/crates/theme_importer/src/main.rs index 02ff4d834e..579b48fe1d 100644 --- a/crates/theme_importer/src/main.rs +++ b/crates/theme_importer/src/main.rs @@ -158,9 +158,10 @@ fn main() -> Result<()> { use gpui::rgba; + #[allow(unused)] use crate::{{ Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserHighlightStyle, UserSyntaxTheme, - UserTheme, UserThemeFamily, UserThemeStylesRefinement, + UserTheme, UserThemeFamily, UserThemeStylesRefinement, UserFontWeight, UserFontStyle }}; pub fn {theme_family_slug}() -> UserThemeFamily {{ diff --git a/crates/theme_importer/src/vscode/converter.rs b/crates/theme_importer/src/vscode/converter.rs index 6557c1b6ef..39cc003094 100644 --- a/crates/theme_importer/src/vscode/converter.rs +++ b/crates/theme_importer/src/vscode/converter.rs @@ -1,15 +1,18 @@ use anyhow::Result; use gpui::{Hsla, Rgba}; use indexmap::IndexMap; +use strum::IntoEnumIterator; use theme::{ - StatusColorsRefinement, ThemeColorsRefinement, UserFontStyle, UserFontWeight, UserSyntaxTheme, - UserTheme, UserThemeStylesRefinement, + StatusColorsRefinement, ThemeColorsRefinement, UserFontStyle, UserFontWeight, + UserHighlightStyle, UserSyntaxTheme, UserTheme, UserThemeStylesRefinement, }; use crate::util::Traverse; use crate::vscode::VsCodeTheme; use crate::ThemeMetadata; +use super::{VsCodeTokenScope, ZedSyntaxToken}; + pub(crate) fn try_parse_color(color: &str) -> Result { Ok(Rgba::try_from(color)?.into()) } @@ -47,16 +50,7 @@ impl VsCodeThemeConverter { let status_color_refinements = self.convert_status_colors()?; let theme_colors_refinements = self.convert_theme_colors()?; - - let mut highlight_styles = IndexMap::new(); - - for token_color in self.theme.token_colors { - highlight_styles.extend(token_color.highlight_styles()?); - } - - let syntax_theme = UserSyntaxTheme { - highlights: highlight_styles.into_iter().collect(), - }; + let syntax_theme = self.convert_syntax_theme()?; Ok(UserTheme { name: self.theme_metadata.name.into(), @@ -259,4 +253,114 @@ impl VsCodeThemeConverter { ..Default::default() }) } + + fn convert_syntax_theme(&self) -> Result { + let mut highlight_styles = IndexMap::new(); + + for syntax_token in ZedSyntaxToken::iter() { + let vscode_scope = syntax_token.to_vscode(); + + let token_color = self + .theme + .token_colors + .iter() + .find(|token_color| match token_color.scope { + Some(VsCodeTokenScope::One(ref scope)) => scope == vscode_scope, + Some(VsCodeTokenScope::Many(ref scopes)) => { + scopes.contains(&vscode_scope.to_string()) + } + None => false, + }); + + let Some(token_color) = token_color else { + continue; + }; + + let highlight_style = UserHighlightStyle { + color: token_color + .settings + .foreground + .as_ref() + .traverse(|color| try_parse_color(&color))?, + font_style: token_color + .settings + .font_style + .as_ref() + .and_then(|style| try_parse_font_style(&style)), + font_weight: token_color + .settings + .font_style + .as_ref() + .and_then(|style| try_parse_font_weight(&style)), + }; + + if highlight_style.is_empty() { + continue; + } + + highlight_styles.insert(syntax_token.to_string(), highlight_style); + } + + Ok(UserSyntaxTheme { + highlights: highlight_styles.into_iter().collect(), + }) + + // let mut highlight_styles = IndexMap::new(); + + // for token_color in self.theme.token_colors { + // highlight_styles.extend(token_color.highlight_styles()?); + // } + + // let syntax_theme = UserSyntaxTheme { + // highlights: highlight_styles.into_iter().collect(), + // }; + + // pub fn highlight_styles(&self) -> Result> { + // let mut highlight_styles = IndexMap::new(); + + // for syntax_token in ZedSyntaxToken::iter() { + // let scope = syntax_token.to_scope(); + + // // let token_color = + // } + + // let scope = match self.scope { + // Some(VsCodeTokenScope::One(ref scope)) => vec![scope.clone()], + // Some(VsCodeTokenScope::Many(ref scopes)) => scopes.clone(), + // None => return Ok(IndexMap::new()), + // }; + + // for scope in &scope { + // let Some(syntax_token) = Self::to_zed_token(&scope) else { + // continue; + // }; + + // let highlight_style = UserHighlightStyle { + // color: self + // .settings + // .foreground + // .as_ref() + // .traverse(|color| try_parse_color(&color))?, + // font_style: self + // .settings + // .font_style + // .as_ref() + // .and_then(|style| try_parse_font_style(&style)), + // font_weight: self + // .settings + // .font_style + // .as_ref() + // .and_then(|style| try_parse_font_weight(&style)), + // }; + + // if highlight_style.is_empty() { + // continue; + // } + + // highlight_styles.insert(syntax_token, highlight_style); + // } + + // Ok(highlight_styles) + // } + } } diff --git a/crates/theme_importer/src/vscode/syntax.rs b/crates/theme_importer/src/vscode/syntax.rs index 1d92914df6..4c3977af93 100644 --- a/crates/theme_importer/src/vscode/syntax.rs +++ b/crates/theme_importer/src/vscode/syntax.rs @@ -1,14 +1,5 @@ -// Create ThemeSyntaxRefinement -// Map tokenColors style to HighlightStyle (fontStyle, foreground, background) -// Take in the scopes from the tokenColors and try to match each to our HighlightStyles - -use anyhow::Result; -use indexmap::IndexMap; use serde::Deserialize; -use theme::UserHighlightStyle; - -use crate::util::Traverse; -use crate::vscode::{try_parse_color, try_parse_font_style, try_parse_font_weight}; +use strum::EnumIter; #[derive(Debug, Deserialize)] #[serde(untagged)] @@ -31,243 +22,145 @@ pub struct VsCodeTokenColorSettings { pub font_style: Option, } -impl VsCodeTokenColor { - pub fn highlight_styles(&self) -> Result> { - let mut highlight_styles = IndexMap::new(); +#[derive(Debug, PartialEq, Copy, Clone, EnumIter)] +pub enum ZedSyntaxToken { + SyntaxAttribute, + SyntaxBoolean, + SyntaxComment, + SyntaxCommentDoc, + SyntaxConstant, + SyntaxConstructor, + SyntaxEmbedded, + SyntaxEmphasis, + SyntaxEmphasisStrong, + SyntaxEnum, + SyntaxFunction, + SyntaxHint, + SyntaxKeyword, + SyntaxLabel, + SyntaxLinkText, + SyntaxLinkUri, + SyntaxNumber, + SyntaxOperator, + SyntaxPredictive, + SyntaxPreproc, + SyntaxPrimary, + SyntaxProperty, + SyntaxPunctuation, + SyntaxPunctuationBracket, + SyntaxPunctuationDelimiter, + SyntaxPunctuationListMarker, + SyntaxPunctuationSpecial, + SyntaxString, + SyntaxStringEscape, + SyntaxStringRegex, + SyntaxStringSpecial, + SyntaxStringSpecialSymbol, + SyntaxTag, + SyntaxTextLiteral, + SyntaxTitle, + SyntaxType, + SyntaxVariable, + SyntaxVariableSpecial, + SyntaxVariant, +} - let scope = match self.scope { - Some(VsCodeTokenScope::One(ref scope)) => vec![scope.clone()], - Some(VsCodeTokenScope::Many(ref scopes)) => scopes.clone(), - None => return Ok(IndexMap::new()), - }; +impl std::fmt::Display for ZedSyntaxToken { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + use ZedSyntaxToken::*; - for scope in &scope { - let Some(syntax_token) = Self::to_zed_token(&scope) else { - continue; - }; - - let highlight_style = UserHighlightStyle { - color: self - .settings - .foreground - .as_ref() - .traverse(|color| try_parse_color(&color))?, - font_style: self - .settings - .font_style - .as_ref() - .and_then(|style| try_parse_font_style(&style)), - font_weight: self - .settings - .font_style - .as_ref() - .and_then(|style| try_parse_font_weight(&style)), - }; - - if highlight_style.is_empty() { - continue; + write!( + f, + "{}", + match self { + SyntaxAttribute => "attribute", + SyntaxBoolean => "boolean", + SyntaxComment => "comment", + SyntaxCommentDoc => "comment.doc", + SyntaxConstant => "constant", + SyntaxConstructor => "constructor", + SyntaxEmbedded => "embedded", + SyntaxEmphasis => "emphasis", + SyntaxEmphasisStrong => "emphasis.strong", + SyntaxEnum => "enum", + SyntaxFunction => "function", + SyntaxHint => "hint", + SyntaxKeyword => "keyword", + SyntaxLabel => "label", + SyntaxLinkText => "link_text", + SyntaxLinkUri => "link_uri", + SyntaxNumber => "number", + SyntaxOperator => "operator", + SyntaxPredictive => "predictive", + SyntaxPreproc => "preproc", + SyntaxPrimary => "primary", + SyntaxProperty => "property", + SyntaxPunctuation => "punctuation", + SyntaxPunctuationBracket => "punctuation.bracket", + SyntaxPunctuationDelimiter => "punctuation.delimiter", + SyntaxPunctuationListMarker => "punctuation.list_marker", + SyntaxPunctuationSpecial => "punctuation.special", + SyntaxString => "string", + SyntaxStringEscape => "string.escape", + SyntaxStringRegex => "string.regex", + SyntaxStringSpecial => "string.special", + SyntaxStringSpecialSymbol => "string.special.symbol", + SyntaxTag => "tag", + SyntaxTextLiteral => "text.literal", + SyntaxTitle => "title", + SyntaxType => "type", + SyntaxVariable => "variable", + SyntaxVariableSpecial => "variable.special", + SyntaxVariant => "variant", } - - highlight_styles.insert(syntax_token, highlight_style); - } - - Ok(highlight_styles) - } - - fn to_zed_token(scope: &str) -> Option { - match scope { - "attribute" => Some("attribute".to_string()), - "boolean" => Some("boolean".to_string()), - "comment" => Some("comment".to_string()), - "comment.doc" => Some("comment.doc".to_string()), - "punctuation" - | "punctuation.accessor" - | "punctuation.definition.array.begin.json" - | "punctuation.definition.array.end.json" - | "punctuation.definition.dictionary.begin.json" - | "punctuation.definition.dictionary.end.json" - | "punctuation.definition.markdown" - | "punctuation.definition.tag" - | "punctuation.definition.tag.begin" - | "punctuation.definition.tag.end" - | "punctuation.definition.template-expression" - | "punctuation.definition.variable" - | "punctuation.section" - | "punctuation.section.embedded" - | "punctuation.section.embedded.begin" - | "punctuation.section.embedded.end" - | "punctuation.separator" - | "punctuation.separator.array.json" - | "punctuation.separator.dictionary.key-value.json" - | "punctuation.separator.dictionary.pair.json" => Some("punctuation".to_string()), - - // --- - "constant" | "character" | "language" | "language.python" | "numeric" | "other" - | "other.symbol" => Some("something".to_string()), - - "entity" - | "name" - | "name.class" - | "name.filename.find-in-files" - | "name.function" - | "name.function.python" - | "name.import" - | "name.package" - | "name.tag" - | "name.type" - | "name.type.class.python" - | "other.attribute-name" - | "other.inherited-class" => Some("something".to_string()), - - "markup" | "bold" | "changed" | "deleted" | "heading" | "heading.setext" - | "inline.raw" | "italic" | "list" | "quote" | "raw" | "raw.inline" | "strike" - | "table" | "underline.link" => Some("something".to_string()), - - "source" => Some("something".to_string()), - "storage" => Some("something".to_string()), - "string" => Some("something".to_string()), - "support" => Some("something".to_string()), - "text" => Some("something".to_string()), - "token" => Some("something".to_string()), - "variable" => Some("something".to_string()), - _ => None, - } + ) } } -// "comment" => "" -// "constant.character" => "" -// "constant.language" => "" -// "constant.language.python" => "" -// "constant.numeric" => "" -// "constant.numeric.line-number.find-in-files - match" => "" -// "constant.numeric.line-number.match" => "" -// "constant.other" => "" -// "constant.other.symbol" => "" -// "entity.name" => "" -// "entity.name.class" => "" -// "entity.name.filename.find-in-files" => "" -// "entity.name.function" => "" -// "entity.name.function.python" => "" -// "entity.name.import" => "" -// "entity.name.package" => "" -// "entity.name.tag" => "" -// "entity.name.type" => "" -// "entity.name.type.class.python" => "" -// "entity.other.attribute-name" => "" -// "entity.other.inherited-class" => "" -// "invalid" => "" -// "keyword" => "" -// "keyword.control.from" => "" -// "keyword.control.import" => "" -// "keyword.operator" => "" -// "keyword.other.new" => "" -// "markup.bold markup.italic" => "" -// "markup.bold" => "" -// "markup.changed" => "" -// "markup.deleted" => "" -// "markup.heading entity.name" => "" -// "markup.heading" => "" -// "markup.heading.setext" => "" -// "markup.inline.raw" => "" -// "markup.inserted" => "" -// "markup.inserted" => "" -// "markup.italic markup.bold" => "" -// "markup.italic" => "" -// "markup.list punctuation.definition.list.begin" => "" -// "markup.list" => "" -// "markup.quote" => "" -// "markup.raw" => "" -// "markup.raw.inline" => "" -// "markup.strike" => "" -// "markup.table" => "" -// "markup.underline.link" => "" -// "message.error" => "" -// "meta.decorator punctuation.decorator" => "" -// "meta.decorator variable.other" => "" -// "meta.diff" => "" -// "meta.diff.header" => "" -// "meta.embedded" => "" -// "meta.function-call" => "" -// "meta.function-call.generic" => "" -// "meta.import" => "" -// "meta.parameter" => "" -// "meta.preprocessor" => "" -// "meta.separator" => "" -// "meta.tag.sgml" => "" -// "punctuation.accessor" => "" -// "punctuation.definition.array.begin.json" => "" -// "punctuation.definition.array.end.json" => "" -// "punctuation.definition.dictionary.begin.json" => "" -// "punctuation.definition.dictionary.end.json" => "" -// "punctuation.definition.markdown" => "" -// "punctuation.definition.tag" => "" -// "punctuation.definition.tag.begin" => "" -// "punctuation.definition.tag.end" => "" -// "punctuation.definition.template-expression" => "" -// "punctuation.definition.variable" => "" -// "punctuation.section" => "" -// "punctuation.section.embedded" => "" -// "punctuation.section.embedded.begin" => "" -// "punctuation.section.embedded.end" => "" -// "punctuation.separator" => "" -// "punctuation.separator.array.json" => "" -// "punctuation.separator.dictionary.key-value.json" => "" -// "punctuation.separator.dictionary.pair.json" => "" -// "punctuation.terminator" => "" -// "source.c storage.type" => "" -// "source.css entity.name.tag" => "" -// "source.css support.type" => "" -// "source.go storage.type" => "" -// "source.groovy.embedded" => "" -// "source.haskell storage.type" => "" -// "source.java storage.type" => "" -// "source.java storage.type.primitive" => "" -// "source.less entity.name.tag" => "" -// "source.less support.type" => "" -// "source.python" => "" -// "source.ruby variable.other.readwrite" => "" -// "source.sass entity.name.tag" => "" -// "source.sass support.type" => "" -// "source.scss entity.name.tag" => "" -// "source.scss support.type" => "" -// "source.stylus entity.name.tag" => "" -// "source.stylus support.type" => "" -// "source.ts" => "" -// "storage" => "" -// "storage.modifier" => "" -// "storage.modifier.async" => "" -// "storage.modifier.tsx" => "" -// "storage.type.annotation" => "" -// "storage.type.function" => "" -// "string" => "" -// "string.other.link" => "" -// "string.regexp" => "" -// "support.class" => "" -// "support.class.component" => "" -// "support.constant" => "" -// "support.function" => "" -// "support.function.construct" => "" -// "support.function.go" => "" -// "support.macro" => "" -// "support.other.variable" => "" -// "support.type" => "" -// "support.type.exception" => "" -// "support.type.primitive" => "" -// "support.type.property-name" => "" -// "support.type.python" => "" -// "text.html.markdown markup.inline.raw" => "" -// "text.html.markdown meta.dummy.line-break" => "" -// "token.debug-token" => "" -// "token.error-token" => "" -// "token.info-token" => "" -// "token.warn-token" => "" -// "variable" => "" -// "variable.annotation" => "" -// "variable.function" => "" -// "variable.language" => "" -// "variable.member" => "" -// "variable.object.property" => "" -// "variable.other" => "" -// "variable.parameter" => "" -// "variable.parameter.function-call" => "" +impl ZedSyntaxToken { + pub fn to_vscode(&self) -> &'static str { + use ZedSyntaxToken::*; + + match self { + SyntaxAttribute => "entity.other.attribute-name", + SyntaxBoolean => "constant.language", + SyntaxComment => "comment", + SyntaxCommentDoc => "comment.block.documentation", + SyntaxConstant => "constant.character", + SyntaxConstructor => "entity.name.function.definition.special.constructor", + SyntaxEmbedded => "embedded", + SyntaxEmphasis => "emphasis", + SyntaxEmphasisStrong => "emphasis.strong", + SyntaxEnum => "support.type.enum", + SyntaxFunction => "entity.name.function", + SyntaxHint => "hint", + SyntaxKeyword => "keyword", + SyntaxLabel => "label", + SyntaxLinkText => "link_text", + SyntaxLinkUri => "link_uri", + SyntaxNumber => "number", + SyntaxOperator => "operator", + SyntaxPredictive => "predictive", + SyntaxPreproc => "preproc", + SyntaxPrimary => "primary", + SyntaxProperty => "variable.object.property", //"variable.other.field" + SyntaxPunctuation => "punctuation", + SyntaxPunctuationBracket => "punctuation.bracket", + SyntaxPunctuationDelimiter => "punctuation.delimiter", + SyntaxPunctuationListMarker => "punctuation.list_marker", + SyntaxPunctuationSpecial => "punctuation.special", + SyntaxString => "string", + SyntaxStringEscape => "string.escape", + SyntaxStringRegex => "string.regex", + SyntaxStringSpecial => "string.special", + SyntaxStringSpecialSymbol => "string.special.symbol", + SyntaxTag => "tag", + SyntaxTextLiteral => "text.literal", + SyntaxTitle => "title", + SyntaxType => "entity.name.type", + SyntaxVariable => "variable.language", + SyntaxVariableSpecial => "variable.special", + SyntaxVariant => "variant", + } + } +}