Finish passing Syntax from VSCode themes to Zed Themes

Co-Authored-By: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>
This commit is contained in:
Nate Butler 2023-11-09 14:41:26 -05:00
parent ff053890cf
commit 54157eb99a
20 changed files with 1797 additions and 470 deletions

1
Cargo.lock generated
View file

@ -9139,6 +9139,7 @@ dependencies = [
"rust-embed", "rust-embed",
"serde", "serde",
"simplelog", "simplelog",
"strum",
"theme2", "theme2",
"uuid 1.4.1", "uuid 1.4.1",
] ]

View file

@ -1,61 +1,61 @@
{ {
"name": "Notctis", "name": "Noctis",
"author": "Liviu Schera (liviuschera)", "author": "Liviu Schera (liviuschera)",
"themes": [ "themes": [
{ {
"name": "Noctis Azureus", "name": "Noctis Azureus",
"file_name": "azureus.json", "file_name": "azureus.json",
"appearance": "dark" "appearance": "dark"
}, },
{ {
"name": "Noctis Bordo", "name": "Noctis Bordo",
"file_name": "bordo.json", "file_name": "bordo.json",
"appearance": "dark" "appearance": "dark"
}, },
{ {
"name": "Noctus Hibernus", "name": "Noctus Hibernus",
"file_name": "hibernus.json", "file_name": "hibernus.json",
"appearance": "light" "appearance": "light"
}, },
{ {
"name": "Noctis Lilac", "name": "Noctis Lilac",
"file_name": "lilac.json", "file_name": "lilac.json",
"appearance": "dark" "appearance": "dark"
}, },
{ {
"name": "Noctis Lux", "name": "Noctis Lux",
"file_name": "lux.json", "file_name": "lux.json",
"appearance": "light" "appearance": "light"
}, },
{ {
"name": "Noctis Minimus", "name": "Noctis Minimus",
"file_name": "minimus.json", "file_name": "minimus.json",
"appearance": "dark" "appearance": "dark"
}, },
{ {
"name": "Noctis", "name": "Noctis",
"file_name": "noctis.json", "file_name": "noctis.json",
"appearance": "dark" "appearance": "dark"
}, },
{ {
"name": "Noctis Obscuro", "name": "Noctis Obscuro",
"file_name": "obscuro.json", "file_name": "obscuro.json",
"appearance": "dark" "appearance": "dark"
}, },
{ {
"name": "Noctis Sereno", "name": "Noctis Sereno",
"file_name": "obscuro.json", "file_name": "obscuro.json",
"appearance": "dark" "appearance": "dark"
}, },
{ {
"name": "Noctis Uva", "name": "Noctis Uva",
"file_name": "uva.json", "file_name": "uva.json",
"appearance": "dark" "appearance": "dark"
}, },
{ {
"name": "Noctis Viola", "name": "Noctis Viola",
"file_name": "viola.json", "file_name": "viola.json",
"appearance": "dark" "appearance": "dark"
} }
] ]
} }

View file

@ -2,7 +2,7 @@ use std::collections::HashMap;
use std::sync::Arc; use std::sync::Arc;
use anyhow::{anyhow, Result}; use anyhow::{anyhow, Result};
use gpui::SharedString; use gpui::{HighlightStyle, SharedString};
use refineable::Refineable; use refineable::Refineable;
use crate::{ use crate::{
@ -39,9 +39,33 @@ impl ThemeRegistry {
Appearance::Light => ThemeColors::default_light(), Appearance::Light => ThemeColors::default_light(),
Appearance::Dark => ThemeColors::default_dark(), Appearance::Dark => ThemeColors::default_dark(),
}; };
theme_colors.refine(&user_theme.styles.colors); 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::<Vec<_>>();
}
Theme { Theme {
id: uuid::Uuid::new_v4().to_string(), id: uuid::Uuid::new_v4().to_string(),
name: user_theme.name.into(), name: user_theme.name.into(),
@ -49,12 +73,9 @@ impl ThemeRegistry {
styles: ThemeStyles { styles: ThemeStyles {
system: SystemColors::default(), system: SystemColors::default(),
colors: theme_colors, colors: theme_colors,
status: StatusColors::default(), status: status_colors,
player: PlayerColors::default(), player: PlayerColors::default(),
syntax: match user_theme.appearance { syntax: Arc::new(syntax_colors),
Appearance::Light => Arc::new(SyntaxTheme::default_light()),
Appearance::Dark => Arc::new(SyntaxTheme::default_dark()),
},
}, },
} }
})); }));

View file

@ -3,9 +3,10 @@
use gpui::rgba; use gpui::rgba;
#[allow(unused)]
use crate::{ use crate::{
Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserHighlightStyle, UserSyntaxTheme, Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserFontStyle, UserFontWeight,
UserTheme, UserThemeFamily, UserThemeStylesRefinement, UserHighlightStyle, UserSyntaxTheme, UserTheme, UserThemeFamily, UserThemeStylesRefinement,
}; };
pub fn andromeda() -> UserThemeFamily { pub fn andromeda() -> UserThemeFamily {
@ -61,6 +62,13 @@ pub fn andromeda() -> UserThemeFamily {
}, },
syntax: Some(UserSyntaxTheme { syntax: Some(UserSyntaxTheme {
highlights: vec![ highlights: vec![
(
"attribute".into(),
UserHighlightStyle {
color: Some(rgba(0xf39c11ff).into()),
..Default::default()
},
),
( (
"comment".into(), "comment".into(),
UserHighlightStyle { 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 { UserHighlightStyle {
color: Some(rgba(0x95e072ff).into()), color: Some(rgba(0x95e072ff).into()),
..Default::default() ..Default::default()
}, },
), ),
( (
"punctuation".into(), "type".into(),
UserHighlightStyle { UserHighlightStyle {
color: Some(rgba(0x95e072ff).into()), color: Some(rgba(0xffe66dff).into()),
..Default::default() ..Default::default()
}, },
), ),
@ -134,6 +156,13 @@ pub fn andromeda() -> UserThemeFamily {
}, },
syntax: Some(UserSyntaxTheme { syntax: Some(UserSyntaxTheme {
highlights: vec![ highlights: vec![
(
"attribute".into(),
UserHighlightStyle {
color: Some(rgba(0xf39c11ff).into()),
..Default::default()
},
),
( (
"comment".into(), "comment".into(),
UserHighlightStyle { 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 { UserHighlightStyle {
color: Some(rgba(0x95e072ff).into()), color: Some(rgba(0x95e072ff).into()),
..Default::default() ..Default::default()
}, },
), ),
( (
"punctuation".into(), "type".into(),
UserHighlightStyle { UserHighlightStyle {
color: Some(rgba(0x95e072ff).into()), color: Some(rgba(0xffe66dff).into()),
..Default::default() ..Default::default()
}, },
), ),

View file

@ -3,9 +3,10 @@
use gpui::rgba; use gpui::rgba;
#[allow(unused)]
use crate::{ use crate::{
Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserHighlightStyle, UserSyntaxTheme, Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserFontStyle, UserFontWeight,
UserTheme, UserThemeFamily, UserThemeStylesRefinement, UserHighlightStyle, UserSyntaxTheme, UserTheme, UserThemeFamily, UserThemeStylesRefinement,
}; };
pub fn ayu() -> UserThemeFamily { pub fn ayu() -> UserThemeFamily {
@ -65,6 +66,20 @@ pub fn ayu() -> UserThemeFamily {
}, },
syntax: Some(UserSyntaxTheme { syntax: Some(UserSyntaxTheme {
highlights: vec![ highlights: vec![
(
"attribute".into(),
UserHighlightStyle {
color: Some(rgba(0xf2ad48ff).into()),
..Default::default()
},
),
(
"boolean".into(),
UserHighlightStyle {
color: Some(rgba(0xa37accff).into()),
..Default::default()
},
),
( (
"comment".into(), "comment".into(),
UserHighlightStyle { 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 { UserHighlightStyle {
color: Some(rgba(0xfa8d3eff).into()), color: Some(rgba(0xfa8d3eff).into()),
..Default::default() ..Default::default()
}, },
), ),
( (
"punctuation".into(), "string".into(),
UserHighlightStyle { 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() ..Default::default()
}, },
), ),
@ -143,6 +180,20 @@ pub fn ayu() -> UserThemeFamily {
}, },
syntax: Some(UserSyntaxTheme { syntax: Some(UserSyntaxTheme {
highlights: vec![ highlights: vec![
(
"attribute".into(),
UserHighlightStyle {
color: Some(rgba(0xffd173ff).into()),
..Default::default()
},
),
(
"boolean".into(),
UserHighlightStyle {
color: Some(rgba(0xdfbfffff).into()),
..Default::default()
},
),
( (
"comment".into(), "comment".into(),
UserHighlightStyle { 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 { UserHighlightStyle {
color: Some(rgba(0xffad65ff).into()), color: Some(rgba(0xffad65ff).into()),
..Default::default() ..Default::default()
}, },
), ),
( (
"punctuation".into(), "string".into(),
UserHighlightStyle { 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() ..Default::default()
}, },
), ),
@ -221,6 +294,20 @@ pub fn ayu() -> UserThemeFamily {
}, },
syntax: Some(UserSyntaxTheme { syntax: Some(UserSyntaxTheme {
highlights: vec![ highlights: vec![
(
"attribute".into(),
UserHighlightStyle {
color: Some(rgba(0xffb353ff).into()),
..Default::default()
},
),
(
"boolean".into(),
UserHighlightStyle {
color: Some(rgba(0xd2a6ffff).into()),
..Default::default()
},
),
( (
"comment".into(), "comment".into(),
UserHighlightStyle { 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 { UserHighlightStyle {
color: Some(rgba(0xff8f3fff).into()), color: Some(rgba(0xff8f3fff).into()),
..Default::default() ..Default::default()
}, },
), ),
( (
"punctuation".into(), "string".into(),
UserHighlightStyle { 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() ..Default::default()
}, },
), ),

View file

@ -3,9 +3,10 @@
use gpui::rgba; use gpui::rgba;
#[allow(unused)]
use crate::{ use crate::{
Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserHighlightStyle, UserSyntaxTheme, Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserFontStyle, UserFontWeight,
UserTheme, UserThemeFamily, UserThemeStylesRefinement, UserHighlightStyle, UserSyntaxTheme, UserTheme, UserThemeFamily, UserThemeStylesRefinement,
}; };
pub fn dracula() -> UserThemeFamily { pub fn dracula() -> UserThemeFamily {
@ -66,6 +67,14 @@ pub fn dracula() -> UserThemeFamily {
}, },
syntax: Some(UserSyntaxTheme { syntax: Some(UserSyntaxTheme {
highlights: vec![ highlights: vec![
(
"attribute".into(),
UserHighlightStyle {
color: Some(rgba(0x50fa7bff).into()),
font_style: Some(UserFontStyle::Italic),
..Default::default()
},
),
( (
"comment".into(), "comment".into(),
UserHighlightStyle { UserHighlightStyle {
@ -74,19 +83,49 @@ pub fn dracula() -> UserThemeFamily {
}, },
), ),
( (
"something".into(), "emphasis".into(),
UserHighlightStyle { UserHighlightStyle {
color: Some(rgba(0xf8f8f2ff).into()), font_style: Some(UserFontStyle::Italic),
..Default::default() ..Default::default()
}, },
), ),
( (
"punctuation".into(), "function".into(),
UserHighlightStyle {
color: Some(rgba(0x50fa7bff).into()),
..Default::default()
},
),
(
"keyword".into(),
UserHighlightStyle { UserHighlightStyle {
color: Some(rgba(0xff79c6ff).into()), color: Some(rgba(0xff79c6ff).into()),
..Default::default() ..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()
},
),
], ],
}), }),
}, },

View file

@ -3,9 +3,10 @@
use gpui::rgba; use gpui::rgba;
#[allow(unused)]
use crate::{ use crate::{
Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserHighlightStyle, UserSyntaxTheme, Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserFontStyle, UserFontWeight,
UserTheme, UserThemeFamily, UserThemeStylesRefinement, UserHighlightStyle, UserSyntaxTheme, UserTheme, UserThemeFamily, UserThemeStylesRefinement,
}; };
pub fn gruvbox() -> UserThemeFamily { pub fn gruvbox() -> UserThemeFamily {
@ -64,6 +65,13 @@ pub fn gruvbox() -> UserThemeFamily {
}, },
syntax: Some(UserSyntaxTheme { syntax: Some(UserSyntaxTheme {
highlights: vec![ highlights: vec![
(
"attribute".into(),
UserHighlightStyle {
color: Some(rgba(0xfabd2eff).into()),
..Default::default()
},
),
( (
"comment".into(), "comment".into(),
UserHighlightStyle { UserHighlightStyle {
@ -73,16 +81,51 @@ pub fn gruvbox() -> UserThemeFamily {
}, },
), ),
( (
"something".into(), "emphasis".into(),
UserHighlightStyle { 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() ..Default::default()
}, },
), ),
( (
"punctuation".into(), "punctuation".into(),
UserHighlightStyle { 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() ..Default::default()
}, },
), ),
@ -141,6 +184,13 @@ pub fn gruvbox() -> UserThemeFamily {
}, },
syntax: Some(UserSyntaxTheme { syntax: Some(UserSyntaxTheme {
highlights: vec![ highlights: vec![
(
"attribute".into(),
UserHighlightStyle {
color: Some(rgba(0xfabd2eff).into()),
..Default::default()
},
),
( (
"comment".into(), "comment".into(),
UserHighlightStyle { UserHighlightStyle {
@ -150,16 +200,51 @@ pub fn gruvbox() -> UserThemeFamily {
}, },
), ),
( (
"something".into(), "emphasis".into(),
UserHighlightStyle { 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() ..Default::default()
}, },
), ),
( (
"punctuation".into(), "punctuation".into(),
UserHighlightStyle { 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() ..Default::default()
}, },
), ),
@ -218,6 +303,13 @@ pub fn gruvbox() -> UserThemeFamily {
}, },
syntax: Some(UserSyntaxTheme { syntax: Some(UserSyntaxTheme {
highlights: vec![ highlights: vec![
(
"attribute".into(),
UserHighlightStyle {
color: Some(rgba(0xfabd2eff).into()),
..Default::default()
},
),
( (
"comment".into(), "comment".into(),
UserHighlightStyle { UserHighlightStyle {
@ -227,16 +319,51 @@ pub fn gruvbox() -> UserThemeFamily {
}, },
), ),
( (
"something".into(), "emphasis".into(),
UserHighlightStyle { 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() ..Default::default()
}, },
), ),
( (
"punctuation".into(), "punctuation".into(),
UserHighlightStyle { 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() ..Default::default()
}, },
), ),
@ -295,6 +422,13 @@ pub fn gruvbox() -> UserThemeFamily {
}, },
syntax: Some(UserSyntaxTheme { syntax: Some(UserSyntaxTheme {
highlights: vec![ highlights: vec![
(
"attribute".into(),
UserHighlightStyle {
color: Some(rgba(0xb57613ff).into()),
..Default::default()
},
),
( (
"comment".into(), "comment".into(),
UserHighlightStyle { UserHighlightStyle {
@ -304,16 +438,51 @@ pub fn gruvbox() -> UserThemeFamily {
}, },
), ),
( (
"something".into(), "emphasis".into(),
UserHighlightStyle { 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() ..Default::default()
}, },
), ),
( (
"punctuation".into(), "punctuation".into(),
UserHighlightStyle { 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() ..Default::default()
}, },
), ),
@ -372,6 +541,13 @@ pub fn gruvbox() -> UserThemeFamily {
}, },
syntax: Some(UserSyntaxTheme { syntax: Some(UserSyntaxTheme {
highlights: vec![ highlights: vec![
(
"attribute".into(),
UserHighlightStyle {
color: Some(rgba(0xb57613ff).into()),
..Default::default()
},
),
( (
"comment".into(), "comment".into(),
UserHighlightStyle { UserHighlightStyle {
@ -381,16 +557,51 @@ pub fn gruvbox() -> UserThemeFamily {
}, },
), ),
( (
"something".into(), "emphasis".into(),
UserHighlightStyle { 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() ..Default::default()
}, },
), ),
( (
"punctuation".into(), "punctuation".into(),
UserHighlightStyle { 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() ..Default::default()
}, },
), ),
@ -449,6 +660,13 @@ pub fn gruvbox() -> UserThemeFamily {
}, },
syntax: Some(UserSyntaxTheme { syntax: Some(UserSyntaxTheme {
highlights: vec![ highlights: vec![
(
"attribute".into(),
UserHighlightStyle {
color: Some(rgba(0xb57613ff).into()),
..Default::default()
},
),
( (
"comment".into(), "comment".into(),
UserHighlightStyle { UserHighlightStyle {
@ -458,16 +676,51 @@ pub fn gruvbox() -> UserThemeFamily {
}, },
), ),
( (
"something".into(), "emphasis".into(),
UserHighlightStyle { 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() ..Default::default()
}, },
), ),
( (
"punctuation".into(), "punctuation".into(),
UserHighlightStyle { 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() ..Default::default()
}, },
), ),

View file

@ -6,8 +6,8 @@ mod ayu;
mod dracula; mod dracula;
mod gruvbox; mod gruvbox;
mod night_owl; mod night_owl;
mod noctis;
mod nord; mod nord;
mod notctis;
mod palenight; mod palenight;
mod rose_pine; mod rose_pine;
mod solarized; mod solarized;
@ -18,8 +18,8 @@ pub use ayu::*;
pub use dracula::*; pub use dracula::*;
pub use gruvbox::*; pub use gruvbox::*;
pub use night_owl::*; pub use night_owl::*;
pub use noctis::*;
pub use nord::*; pub use nord::*;
pub use notctis::*;
pub use palenight::*; pub use palenight::*;
pub use rose_pine::*; pub use rose_pine::*;
pub use solarized::*; pub use solarized::*;
@ -37,7 +37,7 @@ pub(crate) fn all_user_themes() -> Vec<UserThemeFamily> {
dracula(), dracula(),
solarized(), solarized(),
nord(), nord(),
notctis(), noctis(),
ayu(), ayu(),
gruvbox(), gruvbox(),
] ]

View file

@ -3,9 +3,10 @@
use gpui::rgba; use gpui::rgba;
#[allow(unused)]
use crate::{ use crate::{
Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserHighlightStyle, UserSyntaxTheme, Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserFontStyle, UserFontWeight,
UserTheme, UserThemeFamily, UserThemeStylesRefinement, UserHighlightStyle, UserSyntaxTheme, UserTheme, UserThemeFamily, UserThemeStylesRefinement,
}; };
pub fn night_owl() -> UserThemeFamily { pub fn night_owl() -> UserThemeFamily {
@ -65,6 +66,21 @@ pub fn night_owl() -> UserThemeFamily {
}, },
syntax: Some(UserSyntaxTheme { syntax: Some(UserSyntaxTheme {
highlights: vec![ 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(), "comment".into(),
UserHighlightStyle { UserHighlightStyle {
@ -74,16 +90,39 @@ pub fn night_owl() -> UserThemeFamily {
}, },
), ),
( (
"something".into(), "constant".into(),
UserHighlightStyle { UserHighlightStyle {
color: Some(rgba(0x7fcac3ff).into()), color: Some(rgba(0x82aaffff).into()),
..Default::default() ..Default::default()
}, },
), ),
( (
"punctuation".into(), "function".into(),
UserHighlightStyle { 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() ..Default::default()
}, },
), ),
@ -144,6 +183,21 @@ pub fn night_owl() -> UserThemeFamily {
}, },
syntax: Some(UserSyntaxTheme { syntax: Some(UserSyntaxTheme {
highlights: vec![ 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(), "comment".into(),
UserHighlightStyle { UserHighlightStyle {
@ -153,16 +207,39 @@ pub fn night_owl() -> UserThemeFamily {
}, },
), ),
( (
"something".into(), "constant".into(),
UserHighlightStyle { UserHighlightStyle {
color: Some(rgba(0x0b969bff).into()), color: Some(rgba(0x4876d6ff).into()),
..Default::default() ..Default::default()
}, },
), ),
( (
"punctuation".into(), "function".into(),
UserHighlightStyle { 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() ..Default::default()
}, },
), ),

View file

@ -3,14 +3,15 @@
use gpui::rgba; use gpui::rgba;
#[allow(unused)]
use crate::{ use crate::{
Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserHighlightStyle, UserSyntaxTheme, Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserFontStyle, UserFontWeight,
UserTheme, UserThemeFamily, UserThemeStylesRefinement, UserHighlightStyle, UserSyntaxTheme, UserTheme, UserThemeFamily, UserThemeStylesRefinement,
}; };
pub fn notctis() -> UserThemeFamily { pub fn noctis() -> UserThemeFamily {
UserThemeFamily { UserThemeFamily {
name: "Notctis".into(), name: "Noctis".into(),
author: "Liviu Schera (liviuschera)".into(), author: "Liviu Schera (liviuschera)".into(),
themes: vec![ themes: vec![
UserTheme { UserTheme {
@ -67,6 +68,13 @@ pub fn notctis() -> UserThemeFamily {
}, },
syntax: Some(UserSyntaxTheme { syntax: Some(UserSyntaxTheme {
highlights: vec![ highlights: vec![
(
"boolean".into(),
UserHighlightStyle {
color: Some(rgba(0x705febff).into()),
..Default::default()
},
),
( (
"comment".into(), "comment".into(),
UserHighlightStyle { UserHighlightStyle {
@ -75,19 +83,47 @@ pub fn notctis() -> UserThemeFamily {
}, },
), ),
( (
"punctuation".into(), "constant".into(),
UserHighlightStyle { UserHighlightStyle {
color: Some(rgba(0x49ace9ff).into()), color: Some(rgba(0xbecfdaff).into()),
..Default::default() ..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 { UserHighlightStyle {
color: Some(rgba(0x49e9a6ff).into()), color: Some(rgba(0x49e9a6ff).into()),
..Default::default() ..Default::default()
}, },
), ),
(
"variable".into(),
UserHighlightStyle {
color: Some(rgba(0xe66432ff).into()),
..Default::default()
},
),
], ],
}), }),
}, },
@ -146,6 +182,13 @@ pub fn notctis() -> UserThemeFamily {
}, },
syntax: Some(UserSyntaxTheme { syntax: Some(UserSyntaxTheme {
highlights: vec![ highlights: vec![
(
"boolean".into(),
UserHighlightStyle {
color: Some(rgba(0x705febff).into()),
..Default::default()
},
),
( (
"comment".into(), "comment".into(),
UserHighlightStyle { UserHighlightStyle {
@ -154,19 +197,47 @@ pub fn notctis() -> UserThemeFamily {
}, },
), ),
( (
"punctuation".into(), "constant".into(),
UserHighlightStyle { UserHighlightStyle {
color: Some(rgba(0x49ace9ff).into()), color: Some(rgba(0xcbbec2ff).into()),
..Default::default() ..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 { UserHighlightStyle {
color: Some(rgba(0x49e9a6ff).into()), color: Some(rgba(0x49e9a6ff).into()),
..Default::default() ..Default::default()
}, },
), ),
(
"variable".into(),
UserHighlightStyle {
color: Some(rgba(0xe66432ff).into()),
..Default::default()
},
),
], ],
}), }),
}, },
@ -225,6 +296,13 @@ pub fn notctis() -> UserThemeFamily {
}, },
syntax: Some(UserSyntaxTheme { syntax: Some(UserSyntaxTheme {
highlights: vec![ highlights: vec![
(
"boolean".into(),
UserHighlightStyle {
color: Some(rgba(0x5841ffff).into()),
..Default::default()
},
),
( (
"comment".into(), "comment".into(),
UserHighlightStyle { UserHighlightStyle {
@ -233,19 +311,47 @@ pub fn notctis() -> UserThemeFamily {
}, },
), ),
( (
"punctuation".into(), "constant".into(),
UserHighlightStyle { UserHighlightStyle {
color: Some(rgba(0x0094f0ff).into()), color: Some(rgba(0x004d57ff).into()),
..Default::default() ..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 { UserHighlightStyle {
color: Some(rgba(0x00b368ff).into()), color: Some(rgba(0x00b368ff).into()),
..Default::default() ..Default::default()
}, },
), ),
(
"variable".into(),
UserHighlightStyle {
color: Some(rgba(0xe64100ff).into()),
..Default::default()
},
),
], ],
}), }),
}, },
@ -304,6 +410,13 @@ pub fn notctis() -> UserThemeFamily {
}, },
syntax: Some(UserSyntaxTheme { syntax: Some(UserSyntaxTheme {
highlights: vec![ highlights: vec![
(
"boolean".into(),
UserHighlightStyle {
color: Some(rgba(0x5841ffff).into()),
..Default::default()
},
),
( (
"comment".into(), "comment".into(),
UserHighlightStyle { UserHighlightStyle {
@ -312,19 +425,47 @@ pub fn notctis() -> UserThemeFamily {
}, },
), ),
( (
"punctuation".into(), "constant".into(),
UserHighlightStyle { UserHighlightStyle {
color: Some(rgba(0x0094f0ff).into()), color: Some(rgba(0x0c006bff).into()),
..Default::default() ..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 { UserHighlightStyle {
color: Some(rgba(0x00b368ff).into()), color: Some(rgba(0x00b368ff).into()),
..Default::default() ..Default::default()
}, },
), ),
(
"variable".into(),
UserHighlightStyle {
color: Some(rgba(0xe64100ff).into()),
..Default::default()
},
),
], ],
}), }),
}, },
@ -383,6 +524,13 @@ pub fn notctis() -> UserThemeFamily {
}, },
syntax: Some(UserSyntaxTheme { syntax: Some(UserSyntaxTheme {
highlights: vec![ highlights: vec![
(
"boolean".into(),
UserHighlightStyle {
color: Some(rgba(0x5841ffff).into()),
..Default::default()
},
),
( (
"comment".into(), "comment".into(),
UserHighlightStyle { UserHighlightStyle {
@ -391,19 +539,47 @@ pub fn notctis() -> UserThemeFamily {
}, },
), ),
( (
"punctuation".into(), "constant".into(),
UserHighlightStyle { UserHighlightStyle {
color: Some(rgba(0x0094f0ff).into()), color: Some(rgba(0x004d57ff).into()),
..Default::default() ..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 { UserHighlightStyle {
color: Some(rgba(0x00b368ff).into()), color: Some(rgba(0x00b368ff).into()),
..Default::default() ..Default::default()
}, },
), ),
(
"variable".into(),
UserHighlightStyle {
color: Some(rgba(0xe64100ff).into()),
..Default::default()
},
),
], ],
}), }),
}, },
@ -462,6 +638,13 @@ pub fn notctis() -> UserThemeFamily {
}, },
syntax: Some(UserSyntaxTheme { syntax: Some(UserSyntaxTheme {
highlights: vec![ highlights: vec![
(
"boolean".into(),
UserHighlightStyle {
color: Some(rgba(0x7067b1ff).into()),
..Default::default()
},
),
( (
"comment".into(), "comment".into(),
UserHighlightStyle { UserHighlightStyle {
@ -470,19 +653,47 @@ pub fn notctis() -> UserThemeFamily {
}, },
), ),
( (
"punctuation".into(), "constant".into(),
UserHighlightStyle { UserHighlightStyle {
color: Some(rgba(0x5897bfff).into()), color: Some(rgba(0xc5cdd3ff).into()),
..Default::default() ..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 { UserHighlightStyle {
color: Some(rgba(0x72c09fff).into()), color: Some(rgba(0x72c09fff).into()),
..Default::default() ..Default::default()
}, },
), ),
(
"variable".into(),
UserHighlightStyle {
color: Some(rgba(0xc37455ff).into()),
..Default::default()
},
),
], ],
}), }),
}, },
@ -541,6 +752,13 @@ pub fn notctis() -> UserThemeFamily {
}, },
syntax: Some(UserSyntaxTheme { syntax: Some(UserSyntaxTheme {
highlights: vec![ highlights: vec![
(
"boolean".into(),
UserHighlightStyle {
color: Some(rgba(0x705febff).into()),
..Default::default()
},
),
( (
"comment".into(), "comment".into(),
UserHighlightStyle { UserHighlightStyle {
@ -549,19 +767,47 @@ pub fn notctis() -> UserThemeFamily {
}, },
), ),
( (
"punctuation".into(), "constant".into(),
UserHighlightStyle { UserHighlightStyle {
color: Some(rgba(0x49ace9ff).into()), color: Some(rgba(0xb1c9ccff).into()),
..Default::default() ..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 { UserHighlightStyle {
color: Some(rgba(0x49e9a6ff).into()), color: Some(rgba(0x49e9a6ff).into()),
..Default::default() ..Default::default()
}, },
), ),
(
"variable".into(),
UserHighlightStyle {
color: Some(rgba(0xe66432ff).into()),
..Default::default()
},
),
], ],
}), }),
}, },
@ -620,6 +866,13 @@ pub fn notctis() -> UserThemeFamily {
}, },
syntax: Some(UserSyntaxTheme { syntax: Some(UserSyntaxTheme {
highlights: vec![ highlights: vec![
(
"boolean".into(),
UserHighlightStyle {
color: Some(rgba(0x705febff).into()),
..Default::default()
},
),
( (
"comment".into(), "comment".into(),
UserHighlightStyle { UserHighlightStyle {
@ -628,19 +881,47 @@ pub fn notctis() -> UserThemeFamily {
}, },
), ),
( (
"punctuation".into(), "constant".into(),
UserHighlightStyle { UserHighlightStyle {
color: Some(rgba(0x49ace9ff).into()), color: Some(rgba(0xb1c9ccff).into()),
..Default::default() ..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 { UserHighlightStyle {
color: Some(rgba(0x49e9a6ff).into()), color: Some(rgba(0x49e9a6ff).into()),
..Default::default() ..Default::default()
}, },
), ),
(
"variable".into(),
UserHighlightStyle {
color: Some(rgba(0xe66432ff).into()),
..Default::default()
},
),
], ],
}), }),
}, },
@ -699,6 +980,13 @@ pub fn notctis() -> UserThemeFamily {
}, },
syntax: Some(UserSyntaxTheme { syntax: Some(UserSyntaxTheme {
highlights: vec![ highlights: vec![
(
"boolean".into(),
UserHighlightStyle {
color: Some(rgba(0x705febff).into()),
..Default::default()
},
),
( (
"comment".into(), "comment".into(),
UserHighlightStyle { UserHighlightStyle {
@ -707,19 +995,47 @@ pub fn notctis() -> UserThemeFamily {
}, },
), ),
( (
"punctuation".into(), "constant".into(),
UserHighlightStyle { UserHighlightStyle {
color: Some(rgba(0x49ace9ff).into()), color: Some(rgba(0xb1c9ccff).into()),
..Default::default() ..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 { UserHighlightStyle {
color: Some(rgba(0x49e9a6ff).into()), color: Some(rgba(0x49e9a6ff).into()),
..Default::default() ..Default::default()
}, },
), ),
(
"variable".into(),
UserHighlightStyle {
color: Some(rgba(0xe66432ff).into()),
..Default::default()
},
),
], ],
}), }),
}, },
@ -778,6 +1094,13 @@ pub fn notctis() -> UserThemeFamily {
}, },
syntax: Some(UserSyntaxTheme { syntax: Some(UserSyntaxTheme {
highlights: vec![ highlights: vec![
(
"boolean".into(),
UserHighlightStyle {
color: Some(rgba(0x705febff).into()),
..Default::default()
},
),
( (
"comment".into(), "comment".into(),
UserHighlightStyle { UserHighlightStyle {
@ -786,19 +1109,47 @@ pub fn notctis() -> UserThemeFamily {
}, },
), ),
( (
"punctuation".into(), "constant".into(),
UserHighlightStyle { UserHighlightStyle {
color: Some(rgba(0x49ace9ff).into()), color: Some(rgba(0xc5c2d6ff).into()),
..Default::default() ..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 { UserHighlightStyle {
color: Some(rgba(0x49e9a6ff).into()), color: Some(rgba(0x49e9a6ff).into()),
..Default::default() ..Default::default()
}, },
), ),
(
"variable".into(),
UserHighlightStyle {
color: Some(rgba(0xe66432ff).into()),
..Default::default()
},
),
], ],
}), }),
}, },
@ -857,6 +1208,13 @@ pub fn notctis() -> UserThemeFamily {
}, },
syntax: Some(UserSyntaxTheme { syntax: Some(UserSyntaxTheme {
highlights: vec![ highlights: vec![
(
"boolean".into(),
UserHighlightStyle {
color: Some(rgba(0x705febff).into()),
..Default::default()
},
),
( (
"comment".into(), "comment".into(),
UserHighlightStyle { UserHighlightStyle {
@ -865,19 +1223,47 @@ pub fn notctis() -> UserThemeFamily {
}, },
), ),
( (
"punctuation".into(), "constant".into(),
UserHighlightStyle { UserHighlightStyle {
color: Some(rgba(0x49ace9ff).into()), color: Some(rgba(0xccbfd9ff).into()),
..Default::default() ..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 { UserHighlightStyle {
color: Some(rgba(0x49e9a6ff).into()), color: Some(rgba(0x49e9a6ff).into()),
..Default::default() ..Default::default()
}, },
), ),
(
"variable".into(),
UserHighlightStyle {
color: Some(rgba(0xe66432ff).into()),
..Default::default()
},
),
], ],
}), }),
}, },

View file

@ -3,9 +3,10 @@
use gpui::rgba; use gpui::rgba;
#[allow(unused)]
use crate::{ use crate::{
Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserHighlightStyle, UserSyntaxTheme, Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserFontStyle, UserFontWeight,
UserTheme, UserThemeFamily, UserThemeStylesRefinement, UserHighlightStyle, UserSyntaxTheme, UserTheme, UserThemeFamily, UserThemeStylesRefinement,
}; };
pub fn nord() -> UserThemeFamily { pub fn nord() -> UserThemeFamily {
@ -66,6 +67,20 @@ pub fn nord() -> UserThemeFamily {
}, },
syntax: Some(UserSyntaxTheme { syntax: Some(UserSyntaxTheme {
highlights: vec![ highlights: vec![
(
"attribute".into(),
UserHighlightStyle {
color: Some(rgba(0x8fbcbbff).into()),
..Default::default()
},
),
(
"boolean".into(),
UserHighlightStyle {
color: Some(rgba(0x81a1c1ff).into()),
..Default::default()
},
),
( (
"comment".into(), "comment".into(),
UserHighlightStyle { 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 { UserHighlightStyle {
color: Some(rgba(0x81a1c1ff).into()), color: Some(rgba(0x81a1c1ff).into()),
..Default::default() ..Default::default()
}, },
), ),
( (
"something".into(), "punctuation".into(),
UserHighlightStyle {
color: Some(rgba(0xeceff4ff).into()),
..Default::default()
},
),
(
"string".into(),
UserHighlightStyle { UserHighlightStyle {
color: Some(rgba(0xa3be8cff).into()), color: Some(rgba(0xa3be8cff).into()),
..Default::default() ..Default::default()
}, },
), ),
(
"variable".into(),
UserHighlightStyle {
color: Some(rgba(0x81a1c1ff).into()),
..Default::default()
},
),
], ],
}), }),
}, },

View file

@ -3,9 +3,10 @@
use gpui::rgba; use gpui::rgba;
#[allow(unused)]
use crate::{ use crate::{
Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserHighlightStyle, UserSyntaxTheme, Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserFontStyle, UserFontWeight,
UserTheme, UserThemeFamily, UserThemeStylesRefinement, UserHighlightStyle, UserSyntaxTheme, UserTheme, UserThemeFamily, UserThemeStylesRefinement,
}; };
pub fn palenight() -> UserThemeFamily { pub fn palenight() -> UserThemeFamily {
@ -65,6 +66,20 @@ pub fn palenight() -> UserThemeFamily {
}, },
syntax: Some(UserSyntaxTheme { syntax: Some(UserSyntaxTheme {
highlights: vec![ highlights: vec![
(
"attribute".into(),
UserHighlightStyle {
color: Some(rgba(0xffcb6bff).into()),
..Default::default()
},
),
(
"boolean".into(),
UserHighlightStyle {
color: Some(rgba(0x82aaffff).into()),
..Default::default()
},
),
( (
"comment".into(), "comment".into(),
UserHighlightStyle { UserHighlightStyle {
@ -74,16 +89,37 @@ pub fn palenight() -> UserThemeFamily {
}, },
), ),
( (
"something".into(), "constant".into(),
UserHighlightStyle { UserHighlightStyle {
color: Some(rgba(0x7fcac3ff).into()), color: Some(rgba(0x82aaffff).into()),
..Default::default() ..Default::default()
}, },
), ),
( (
"punctuation".into(), "function".into(),
UserHighlightStyle { 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() ..Default::default()
}, },
), ),
@ -143,6 +179,20 @@ pub fn palenight() -> UserThemeFamily {
}, },
syntax: Some(UserSyntaxTheme { syntax: Some(UserSyntaxTheme {
highlights: vec![ highlights: vec![
(
"attribute".into(),
UserHighlightStyle {
color: Some(rgba(0xffcb6bff).into()),
..Default::default()
},
),
(
"boolean".into(),
UserHighlightStyle {
color: Some(rgba(0x82aaffff).into()),
..Default::default()
},
),
( (
"comment".into(), "comment".into(),
UserHighlightStyle { UserHighlightStyle {
@ -152,16 +202,37 @@ pub fn palenight() -> UserThemeFamily {
}, },
), ),
( (
"something".into(), "constant".into(),
UserHighlightStyle { UserHighlightStyle {
color: Some(rgba(0x7fcac3ff).into()), color: Some(rgba(0x82aaffff).into()),
..Default::default() ..Default::default()
}, },
), ),
( (
"punctuation".into(), "function".into(),
UserHighlightStyle { 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() ..Default::default()
}, },
), ),
@ -221,6 +292,20 @@ pub fn palenight() -> UserThemeFamily {
}, },
syntax: Some(UserSyntaxTheme { syntax: Some(UserSyntaxTheme {
highlights: vec![ highlights: vec![
(
"attribute".into(),
UserHighlightStyle {
color: Some(rgba(0xffcb6bff).into()),
..Default::default()
},
),
(
"boolean".into(),
UserHighlightStyle {
color: Some(rgba(0x82aaffff).into()),
..Default::default()
},
),
( (
"comment".into(), "comment".into(),
UserHighlightStyle { UserHighlightStyle {
@ -230,16 +315,37 @@ pub fn palenight() -> UserThemeFamily {
}, },
), ),
( (
"something".into(), "constant".into(),
UserHighlightStyle { UserHighlightStyle {
color: Some(rgba(0x7fcac3ff).into()), color: Some(rgba(0x82aaffff).into()),
..Default::default() ..Default::default()
}, },
), ),
( (
"punctuation".into(), "function".into(),
UserHighlightStyle { 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() ..Default::default()
}, },
), ),

View file

@ -3,9 +3,10 @@
use gpui::rgba; use gpui::rgba;
#[allow(unused)]
use crate::{ use crate::{
Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserHighlightStyle, UserSyntaxTheme, Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserFontStyle, UserFontWeight,
UserTheme, UserThemeFamily, UserThemeStylesRefinement, UserHighlightStyle, UserSyntaxTheme, UserTheme, UserThemeFamily, UserThemeStylesRefinement,
}; };
pub fn rose_pine() -> UserThemeFamily { pub fn rose_pine() -> UserThemeFamily {
@ -66,6 +67,21 @@ pub fn rose_pine() -> UserThemeFamily {
}, },
syntax: Some(UserSyntaxTheme { syntax: Some(UserSyntaxTheme {
highlights: vec![ 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(), "comment".into(),
UserHighlightStyle { UserHighlightStyle {
@ -75,17 +91,37 @@ pub fn rose_pine() -> UserThemeFamily {
}, },
), ),
( (
"something".into(), "keyword".into(),
UserHighlightStyle { UserHighlightStyle {
color: Some(rgba(0xebbcbaff).into()), color: Some(rgba(0x30738fff).into()),
font_style: Some(UserFontStyle::Italic),
..Default::default() ..Default::default()
}, },
), ),
( (
"punctuation".into(), "punctuation".into(),
UserHighlightStyle { 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() ..Default::default()
}, },
), ),
@ -146,6 +182,21 @@ pub fn rose_pine() -> UserThemeFamily {
}, },
syntax: Some(UserSyntaxTheme { syntax: Some(UserSyntaxTheme {
highlights: vec![ 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(), "comment".into(),
UserHighlightStyle { UserHighlightStyle {
@ -155,17 +206,37 @@ pub fn rose_pine() -> UserThemeFamily {
}, },
), ),
( (
"something".into(), "keyword".into(),
UserHighlightStyle { UserHighlightStyle {
color: Some(rgba(0xea9a97ff).into()), color: Some(rgba(0x3d8fb0ff).into()),
font_style: Some(UserFontStyle::Italic),
..Default::default() ..Default::default()
}, },
), ),
( (
"punctuation".into(), "punctuation".into(),
UserHighlightStyle { 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() ..Default::default()
}, },
), ),
@ -226,6 +297,21 @@ pub fn rose_pine() -> UserThemeFamily {
}, },
syntax: Some(UserSyntaxTheme { syntax: Some(UserSyntaxTheme {
highlights: vec![ 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(), "comment".into(),
UserHighlightStyle { UserHighlightStyle {
@ -235,17 +321,37 @@ pub fn rose_pine() -> UserThemeFamily {
}, },
), ),
( (
"something".into(), "keyword".into(),
UserHighlightStyle { UserHighlightStyle {
color: Some(rgba(0xd7827dff).into()), color: Some(rgba(0x276983ff).into()),
font_style: Some(UserFontStyle::Italic),
..Default::default() ..Default::default()
}, },
), ),
( (
"punctuation".into(), "punctuation".into(),
UserHighlightStyle { 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() ..Default::default()
}, },
), ),

View file

@ -3,9 +3,10 @@
use gpui::rgba; use gpui::rgba;
#[allow(unused)]
use crate::{ use crate::{
Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserHighlightStyle, UserSyntaxTheme, Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserFontStyle, UserFontWeight,
UserTheme, UserThemeFamily, UserThemeStylesRefinement, UserHighlightStyle, UserSyntaxTheme, UserTheme, UserThemeFamily, UserThemeStylesRefinement,
}; };
pub fn solarized() -> UserThemeFamily { pub fn solarized() -> UserThemeFamily {
@ -61,6 +62,20 @@ pub fn solarized() -> UserThemeFamily {
}, },
syntax: Some(UserSyntaxTheme { syntax: Some(UserSyntaxTheme {
highlights: vec![ highlights: vec![
(
"attribute".into(),
UserHighlightStyle {
color: Some(rgba(0x93a1a1ff).into()),
..Default::default()
},
),
(
"boolean".into(),
UserHighlightStyle {
color: Some(rgba(0xb58800ff).into()),
..Default::default()
},
),
( (
"comment".into(), "comment".into(),
UserHighlightStyle { UserHighlightStyle {
@ -70,17 +85,51 @@ pub fn solarized() -> UserThemeFamily {
}, },
), ),
( (
"something".into(), "constant".into(),
UserHighlightStyle { UserHighlightStyle {
color: Some(rgba(0x93a1a1ff).into()), color: Some(rgba(0xcb4b15ff).into()),
font_weight: Some(UserFontWeight(700.0)),
..Default::default() ..Default::default()
}, },
), ),
( (
"punctuation".into(), "function".into(),
UserHighlightStyle { 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() ..Default::default()
}, },
), ),
@ -133,6 +182,20 @@ pub fn solarized() -> UserThemeFamily {
}, },
syntax: Some(UserSyntaxTheme { syntax: Some(UserSyntaxTheme {
highlights: vec![ highlights: vec![
(
"attribute".into(),
UserHighlightStyle {
color: Some(rgba(0x93a1a1ff).into()),
..Default::default()
},
),
(
"boolean".into(),
UserHighlightStyle {
color: Some(rgba(0xb58800ff).into()),
..Default::default()
},
),
( (
"comment".into(), "comment".into(),
UserHighlightStyle { UserHighlightStyle {
@ -142,16 +205,44 @@ pub fn solarized() -> UserThemeFamily {
}, },
), ),
( (
"something".into(), "constant".into(),
UserHighlightStyle { UserHighlightStyle {
color: Some(rgba(0x657b83ff).into()), color: Some(rgba(0xcb4b15ff).into()),
..Default::default() ..Default::default()
}, },
), ),
( (
"punctuation".into(), "function".into(),
UserHighlightStyle { 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() ..Default::default()
}, },
), ),

View file

@ -3,9 +3,10 @@
use gpui::rgba; use gpui::rgba;
#[allow(unused)]
use crate::{ use crate::{
Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserHighlightStyle, UserSyntaxTheme, Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserFontStyle, UserFontWeight,
UserTheme, UserThemeFamily, UserThemeStylesRefinement, UserHighlightStyle, UserSyntaxTheme, UserTheme, UserThemeFamily, UserThemeStylesRefinement,
}; };
pub fn synthwave_84() -> UserThemeFamily { pub fn synthwave_84() -> UserThemeFamily {
@ -51,6 +52,20 @@ pub fn synthwave_84() -> UserThemeFamily {
}, },
syntax: Some(UserSyntaxTheme { syntax: Some(UserSyntaxTheme {
highlights: vec![ highlights: vec![
(
"attribute".into(),
UserHighlightStyle {
color: Some(rgba(0xfede5cff).into()),
..Default::default()
},
),
(
"boolean".into(),
UserHighlightStyle {
color: Some(rgba(0xf97d71ff).into()),
..Default::default()
},
),
( (
"comment".into(), "comment".into(),
UserHighlightStyle { 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 { UserHighlightStyle {
color: Some(rgba(0xfe444fff).into()), color: Some(rgba(0xfe444fff).into()),
..Default::default() ..Default::default()
}, },
), ),
( (
"punctuation".into(), "variable".into(),
UserHighlightStyle { UserHighlightStyle {
color: Some(rgba(0xfede5cff).into()), color: Some(rgba(0xfe444fff).into()),
font_weight: Some(UserFontWeight(700.0)),
..Default::default() ..Default::default()
}, },
), ),

View file

@ -1,4 +1,4 @@
use gpui::{FontWeight, Hsla}; use gpui::{FontStyle, FontWeight, Hsla};
use refineable::Refineable; use refineable::Refineable;
use serde::Deserialize; use serde::Deserialize;
@ -40,7 +40,7 @@ pub struct UserHighlightStyle {
pub font_weight: Option<UserFontWeight>, pub font_weight: Option<UserFontWeight>,
} }
#[derive(Clone, Default, Deserialize)] #[derive(Clone, Copy, Default, Deserialize)]
pub struct UserFontWeight(pub f32); pub struct UserFontWeight(pub f32);
impl UserFontWeight { impl UserFontWeight {
@ -64,6 +64,12 @@ impl UserFontWeight {
pub const BLACK: Self = Self(FontWeight::BLACK.0); pub const BLACK: Self = Self(FontWeight::BLACK.0);
} }
impl From<UserFontWeight> for FontWeight {
fn from(value: UserFontWeight) -> Self {
Self(value.0)
}
}
#[derive(Debug, Clone, Copy, Deserialize)] #[derive(Debug, Clone, Copy, Deserialize)]
pub enum UserFontStyle { pub enum UserFontStyle {
Normal, Normal,
@ -71,8 +77,18 @@ pub enum UserFontStyle {
Oblique, Oblique,
} }
impl UserHighlightStyle { impl From<UserFontStyle> for FontStyle {
pub fn is_empty(&self) -> bool { fn from(value: UserFontStyle) -> Self {
self.color.is_none() 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()
} }
} }

View file

@ -15,5 +15,6 @@ log.workspace = true
rust-embed.workspace = true rust-embed.workspace = true
serde.workspace = true serde.workspace = true
simplelog = "0.9" simplelog = "0.9"
strum = { version = "0.25.0", features = ["derive"] }
theme = { package = "theme2", path = "../theme2", features = ["importing-themes"] } theme = { package = "theme2", path = "../theme2", features = ["importing-themes"] }
uuid.workspace = true uuid.workspace = true

View file

@ -158,9 +158,10 @@ fn main() -> Result<()> {
use gpui::rgba; use gpui::rgba;
#[allow(unused)]
use crate::{{ use crate::{{
Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserHighlightStyle, UserSyntaxTheme, Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserHighlightStyle, UserSyntaxTheme,
UserTheme, UserThemeFamily, UserThemeStylesRefinement, UserTheme, UserThemeFamily, UserThemeStylesRefinement, UserFontWeight, UserFontStyle
}}; }};
pub fn {theme_family_slug}() -> UserThemeFamily {{ pub fn {theme_family_slug}() -> UserThemeFamily {{

View file

@ -1,15 +1,18 @@
use anyhow::Result; use anyhow::Result;
use gpui::{Hsla, Rgba}; use gpui::{Hsla, Rgba};
use indexmap::IndexMap; use indexmap::IndexMap;
use strum::IntoEnumIterator;
use theme::{ use theme::{
StatusColorsRefinement, ThemeColorsRefinement, UserFontStyle, UserFontWeight, UserSyntaxTheme, StatusColorsRefinement, ThemeColorsRefinement, UserFontStyle, UserFontWeight,
UserTheme, UserThemeStylesRefinement, UserHighlightStyle, UserSyntaxTheme, UserTheme, UserThemeStylesRefinement,
}; };
use crate::util::Traverse; use crate::util::Traverse;
use crate::vscode::VsCodeTheme; use crate::vscode::VsCodeTheme;
use crate::ThemeMetadata; use crate::ThemeMetadata;
use super::{VsCodeTokenScope, ZedSyntaxToken};
pub(crate) fn try_parse_color(color: &str) -> Result<Hsla> { pub(crate) fn try_parse_color(color: &str) -> Result<Hsla> {
Ok(Rgba::try_from(color)?.into()) Ok(Rgba::try_from(color)?.into())
} }
@ -47,16 +50,7 @@ impl VsCodeThemeConverter {
let status_color_refinements = self.convert_status_colors()?; let status_color_refinements = self.convert_status_colors()?;
let theme_colors_refinements = self.convert_theme_colors()?; let theme_colors_refinements = self.convert_theme_colors()?;
let syntax_theme = self.convert_syntax_theme()?;
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(),
};
Ok(UserTheme { Ok(UserTheme {
name: self.theme_metadata.name.into(), name: self.theme_metadata.name.into(),
@ -259,4 +253,114 @@ impl VsCodeThemeConverter {
..Default::default() ..Default::default()
}) })
} }
fn convert_syntax_theme(&self) -> Result<UserSyntaxTheme> {
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<IndexMap<String, UserHighlightStyle>> {
// 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)
// }
}
} }

View file

@ -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 serde::Deserialize;
use theme::UserHighlightStyle; use strum::EnumIter;
use crate::util::Traverse;
use crate::vscode::{try_parse_color, try_parse_font_style, try_parse_font_weight};
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(untagged)] #[serde(untagged)]
@ -31,243 +22,145 @@ pub struct VsCodeTokenColorSettings {
pub font_style: Option<String>, pub font_style: Option<String>,
} }
impl VsCodeTokenColor { #[derive(Debug, PartialEq, Copy, Clone, EnumIter)]
pub fn highlight_styles(&self) -> Result<IndexMap<String, UserHighlightStyle>> { pub enum ZedSyntaxToken {
let mut highlight_styles = IndexMap::new(); 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 { impl std::fmt::Display for ZedSyntaxToken {
Some(VsCodeTokenScope::One(ref scope)) => vec![scope.clone()], fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
Some(VsCodeTokenScope::Many(ref scopes)) => scopes.clone(), use ZedSyntaxToken::*;
None => return Ok(IndexMap::new()),
};
for scope in &scope { write!(
let Some(syntax_token) = Self::to_zed_token(&scope) else { f,
continue; "{}",
}; match self {
SyntaxAttribute => "attribute",
let highlight_style = UserHighlightStyle { SyntaxBoolean => "boolean",
color: self SyntaxComment => "comment",
.settings SyntaxCommentDoc => "comment.doc",
.foreground SyntaxConstant => "constant",
.as_ref() SyntaxConstructor => "constructor",
.traverse(|color| try_parse_color(&color))?, SyntaxEmbedded => "embedded",
font_style: self SyntaxEmphasis => "emphasis",
.settings SyntaxEmphasisStrong => "emphasis.strong",
.font_style SyntaxEnum => "enum",
.as_ref() SyntaxFunction => "function",
.and_then(|style| try_parse_font_style(&style)), SyntaxHint => "hint",
font_weight: self SyntaxKeyword => "keyword",
.settings SyntaxLabel => "label",
.font_style SyntaxLinkText => "link_text",
.as_ref() SyntaxLinkUri => "link_uri",
.and_then(|style| try_parse_font_weight(&style)), SyntaxNumber => "number",
}; SyntaxOperator => "operator",
SyntaxPredictive => "predictive",
if highlight_style.is_empty() { SyntaxPreproc => "preproc",
continue; 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<String> {
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" => "" impl ZedSyntaxToken {
// "constant.character" => "" pub fn to_vscode(&self) -> &'static str {
// "constant.language" => "" use ZedSyntaxToken::*;
// "constant.language.python" => ""
// "constant.numeric" => "" match self {
// "constant.numeric.line-number.find-in-files - match" => "" SyntaxAttribute => "entity.other.attribute-name",
// "constant.numeric.line-number.match" => "" SyntaxBoolean => "constant.language",
// "constant.other" => "" SyntaxComment => "comment",
// "constant.other.symbol" => "" SyntaxCommentDoc => "comment.block.documentation",
// "entity.name" => "" SyntaxConstant => "constant.character",
// "entity.name.class" => "" SyntaxConstructor => "entity.name.function.definition.special.constructor",
// "entity.name.filename.find-in-files" => "" SyntaxEmbedded => "embedded",
// "entity.name.function" => "" SyntaxEmphasis => "emphasis",
// "entity.name.function.python" => "" SyntaxEmphasisStrong => "emphasis.strong",
// "entity.name.import" => "" SyntaxEnum => "support.type.enum",
// "entity.name.package" => "" SyntaxFunction => "entity.name.function",
// "entity.name.tag" => "" SyntaxHint => "hint",
// "entity.name.type" => "" SyntaxKeyword => "keyword",
// "entity.name.type.class.python" => "" SyntaxLabel => "label",
// "entity.other.attribute-name" => "" SyntaxLinkText => "link_text",
// "entity.other.inherited-class" => "" SyntaxLinkUri => "link_uri",
// "invalid" => "" SyntaxNumber => "number",
// "keyword" => "" SyntaxOperator => "operator",
// "keyword.control.from" => "" SyntaxPredictive => "predictive",
// "keyword.control.import" => "" SyntaxPreproc => "preproc",
// "keyword.operator" => "" SyntaxPrimary => "primary",
// "keyword.other.new" => "" SyntaxProperty => "variable.object.property", //"variable.other.field"
// "markup.bold markup.italic" => "" SyntaxPunctuation => "punctuation",
// "markup.bold" => "" SyntaxPunctuationBracket => "punctuation.bracket",
// "markup.changed" => "" SyntaxPunctuationDelimiter => "punctuation.delimiter",
// "markup.deleted" => "" SyntaxPunctuationListMarker => "punctuation.list_marker",
// "markup.heading entity.name" => "" SyntaxPunctuationSpecial => "punctuation.special",
// "markup.heading" => "" SyntaxString => "string",
// "markup.heading.setext" => "" SyntaxStringEscape => "string.escape",
// "markup.inline.raw" => "" SyntaxStringRegex => "string.regex",
// "markup.inserted" => "" SyntaxStringSpecial => "string.special",
// "markup.inserted" => "" SyntaxStringSpecialSymbol => "string.special.symbol",
// "markup.italic markup.bold" => "" SyntaxTag => "tag",
// "markup.italic" => "" SyntaxTextLiteral => "text.literal",
// "markup.list punctuation.definition.list.begin" => "" SyntaxTitle => "title",
// "markup.list" => "" SyntaxType => "entity.name.type",
// "markup.quote" => "" SyntaxVariable => "variable.language",
// "markup.raw" => "" SyntaxVariableSpecial => "variable.special",
// "markup.raw.inline" => "" SyntaxVariant => "variant",
// "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" => ""