diff --git a/crates/theme/src/default_theme.rs b/crates/theme/src/default_theme.rs index bbcab499af267c5c83b4c9f702c6dae9efcf070c..de2bb06ff6d356dd3af2aeb30dc5d2b472f02d81 100644 --- a/crates/theme/src/default_theme.rs +++ b/crates/theme/src/default_theme.rs @@ -22,7 +22,7 @@ fn zed_pro_daylight() -> Theme { colors: ThemeColors::light(), status: StatusColors::light(), player: PlayerColors::light(), - syntax: Arc::new(SyntaxTheme::light()), + syntax: Arc::new(SyntaxTheme::default()), accents: vec![ blue().light().step_9(), orange().light().step_9(), @@ -53,7 +53,7 @@ pub(crate) fn zed_pro_moonlight() -> Theme { colors: ThemeColors::dark(), status: StatusColors::dark(), player: PlayerColors::dark(), - syntax: Arc::new(SyntaxTheme::dark()), + syntax: Arc::new(SyntaxTheme::default()), accents: vec![ blue().dark().step_9(), orange().dark().step_9(), diff --git a/crates/theme/src/registry.rs b/crates/theme/src/registry.rs index 5488577b52ad65db1388fb06f10290de46898428..281cf794953e7628c7067076dfe590cc96a5156b 100644 --- a/crates/theme/src/registry.rs +++ b/crates/theme/src/registry.rs @@ -118,10 +118,6 @@ impl ThemeRegistry { }; player_colors.merge(&user_theme.style.players); - let syntax_theme = match user_theme.appearance { - AppearanceContent::Light => SyntaxTheme::light(), - AppearanceContent::Dark => SyntaxTheme::dark(), - }; let syntax_highlights = user_theme .style .syntax @@ -141,7 +137,8 @@ impl ThemeRegistry { ) }) .collect::>(); - let syntax_theme = SyntaxTheme::merge(Arc::new(syntax_theme), syntax_highlights); + let syntax_theme = + SyntaxTheme::merge(Arc::new(SyntaxTheme::default()), syntax_highlights); let window_background_appearance = user_theme .style diff --git a/crates/theme/src/styles/syntax.rs b/crates/theme/src/styles/syntax.rs index 2e735ab274783ceff7ddcf8ba28969ff04b81fca..eff2bbc44e38325f9517d1e81c8584952ca874f3 100644 --- a/crates/theme/src/styles/syntax.rs +++ b/crates/theme/src/styles/syntax.rs @@ -2,133 +2,12 @@ use std::sync::Arc; use gpui::{HighlightStyle, Hsla}; -use crate::{ - blue, cyan, gold, indigo, iris, jade, lime, mint, neutral, orange, plum, purple, red, sky, - tomato, yellow, -}; - #[derive(Debug, PartialEq, Eq, Clone, Default)] pub struct SyntaxTheme { pub highlights: Vec<(String, HighlightStyle)>, } impl SyntaxTheme { - pub fn light() -> Self { - Self { - highlights: vec![ - ("attribute".into(), cyan().light().step_11().into()), - ("boolean".into(), tomato().light().step_11().into()), - ("comment".into(), neutral().light().step_10().into()), - ("comment.doc".into(), iris().light().step_11().into()), - ("constant".into(), red().light().step_9().into()), - ("constructor".into(), red().light().step_9().into()), - ("embedded".into(), red().light().step_9().into()), - ("emphasis".into(), red().light().step_9().into()), - ("emphasis.strong".into(), red().light().step_9().into()), - ("enum".into(), red().light().step_9().into()), - ("function".into(), red().light().step_9().into()), - ("hint".into(), red().light().step_9().into()), - ("keyword".into(), orange().light().step_9().into()), - ("label".into(), red().light().step_9().into()), - ("link_text".into(), red().light().step_9().into()), - ("link_uri".into(), red().light().step_9().into()), - ("number".into(), purple().light().step_10().into()), - ("operator".into(), red().light().step_9().into()), - ("predictive".into(), red().light().step_9().into()), - ("preproc".into(), red().light().step_9().into()), - ("primary".into(), red().light().step_9().into()), - ("property".into(), red().light().step_9().into()), - ("punctuation".into(), neutral().light().step_11().into()), - ( - "punctuation.bracket".into(), - neutral().light().step_11().into(), - ), - ( - "punctuation.delimiter".into(), - neutral().light().step_10().into(), - ), - ( - "punctuation.list_marker".into(), - blue().light().step_11().into(), - ), - ("punctuation.special".into(), red().light().step_9().into()), - ("string".into(), jade().light().step_9().into()), - ("string.escape".into(), red().light().step_9().into()), - ("string.regex".into(), tomato().light().step_9().into()), - ("string.special".into(), red().light().step_9().into()), - ( - "string.special.symbol".into(), - red().light().step_9().into(), - ), - ("tag".into(), red().light().step_9().into()), - ("text.literal".into(), red().light().step_9().into()), - ("title".into(), red().light().step_9().into()), - ("type".into(), cyan().light().step_9().into()), - ("variable".into(), red().light().step_9().into()), - ("variable.special".into(), red().light().step_9().into()), - ("variant".into(), red().light().step_9().into()), - ], - } - } - - pub fn dark() -> Self { - Self { - highlights: vec![ - ("attribute".into(), tomato().dark().step_11().into()), - ("boolean".into(), tomato().dark().step_11().into()), - ("comment".into(), neutral().dark().step_11().into()), - ("comment.doc".into(), iris().dark().step_12().into()), - ("constant".into(), orange().dark().step_11().into()), - ("constructor".into(), gold().dark().step_11().into()), - ("embedded".into(), red().dark().step_11().into()), - ("emphasis".into(), red().dark().step_11().into()), - ("emphasis.strong".into(), red().dark().step_11().into()), - ("enum".into(), yellow().dark().step_11().into()), - ("function".into(), blue().dark().step_11().into()), - ("hint".into(), indigo().dark().step_11().into()), - ("keyword".into(), plum().dark().step_11().into()), - ("label".into(), red().dark().step_11().into()), - ("link_text".into(), red().dark().step_11().into()), - ("link_uri".into(), red().dark().step_11().into()), - ("number".into(), red().dark().step_11().into()), - ("operator".into(), red().dark().step_11().into()), - ("predictive".into(), red().dark().step_11().into()), - ("preproc".into(), red().dark().step_11().into()), - ("primary".into(), red().dark().step_11().into()), - ("property".into(), red().dark().step_11().into()), - ("punctuation".into(), neutral().dark().step_11().into()), - ( - "punctuation.bracket".into(), - neutral().dark().step_11().into(), - ), - ( - "punctuation.delimiter".into(), - neutral().dark().step_11().into(), - ), - ( - "punctuation.list_marker".into(), - blue().dark().step_11().into(), - ), - ("punctuation.special".into(), red().dark().step_11().into()), - ("string".into(), lime().dark().step_11().into()), - ("string.escape".into(), orange().dark().step_11().into()), - ("string.regex".into(), tomato().dark().step_11().into()), - ("string.special".into(), red().dark().step_11().into()), - ( - "string.special.symbol".into(), - red().dark().step_11().into(), - ), - ("tag".into(), red().dark().step_11().into()), - ("text.literal".into(), purple().dark().step_11().into()), - ("title".into(), sky().dark().step_11().into()), - ("type".into(), mint().dark().step_11().into()), - ("variable".into(), red().dark().step_11().into()), - ("variable.special".into(), red().dark().step_11().into()), - ("variant".into(), red().dark().step_11().into()), - ], - } - } - #[cfg(any(test, feature = "test-support"))] pub fn new_test(colors: impl IntoIterator) -> Self { Self::new_test_styles(colors.into_iter().map(|(key, color)| {