Merge branch 'main' into document-theme
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use gpui::Hsla;
|
||||
use refineable::Refineable;
|
||||
|
||||
@@ -237,7 +239,7 @@ pub struct ThemeStyles {
|
||||
pub status: StatusColors,
|
||||
pub git: GitStatusColors,
|
||||
pub player: PlayerColors,
|
||||
pub syntax: SyntaxTheme,
|
||||
pub syntax: Arc<SyntaxTheme>,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -138,6 +138,8 @@ impl SyntaxTheme {
|
||||
("variable.special".into(), red().light().step_7().into()),
|
||||
("variant".into(), red().light().step_7().into()),
|
||||
],
|
||||
inlay_style: tomato().light().step_1().into(), // todo!("nate: use a proper style")
|
||||
suggestion_style: orange().light().step_1().into(), // todo!("nate: use proper style")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,6 +195,8 @@ impl SyntaxTheme {
|
||||
("variable.special".into(), red().dark().step_7().into()),
|
||||
("variant".into(), red().dark().step_7().into()),
|
||||
],
|
||||
inlay_style: tomato().dark().step_1().into(), // todo!("nate: use a proper style")
|
||||
suggestion_style: orange().dark().step_1().into(), // todo!("nate: use a proper style")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::{
|
||||
colors::{GitStatusColors, PlayerColors, StatusColors, SystemColors, ThemeColors, ThemeStyles},
|
||||
default_color_scales, Appearance, SyntaxTheme, Theme, ThemeFamily,
|
||||
@@ -14,7 +16,7 @@ fn zed_pro_daylight() -> Theme {
|
||||
status: StatusColors::default(),
|
||||
git: GitStatusColors::default(),
|
||||
player: PlayerColors::default(),
|
||||
syntax: SyntaxTheme::default_light(),
|
||||
syntax: Arc::new(SyntaxTheme::default_light()),
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -30,7 +32,7 @@ pub(crate) fn zed_pro_moonlight() -> Theme {
|
||||
status: StatusColors::default(),
|
||||
git: GitStatusColors::default(),
|
||||
player: PlayerColors::default(),
|
||||
syntax: SyntaxTheme::default_dark(),
|
||||
syntax: Arc::new(SyntaxTheme::default_dark()),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,10 @@ impl ThemeRegistry {
|
||||
status: StatusColors::default(),
|
||||
git: GitStatusColors::default(),
|
||||
player: PlayerColors::default(),
|
||||
syntax: SyntaxTheme::default_dark(),
|
||||
syntax: match user_theme.appearance {
|
||||
Appearance::Light => Arc::new(SyntaxTheme::default_light()),
|
||||
Appearance::Dark => Arc::new(SyntaxTheme::default_dark()),
|
||||
},
|
||||
},
|
||||
}
|
||||
}));
|
||||
@@ -81,7 +84,7 @@ impl Default for ThemeRegistry {
|
||||
};
|
||||
|
||||
this.insert_theme_families([zed_pro_family()]);
|
||||
this.insert_user_theme_familes(crate::all_imported_themes());
|
||||
this.insert_user_theme_familes(crate::all_user_themes());
|
||||
|
||||
this
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ use gpui::{HighlightStyle, Hsla};
|
||||
#[derive(Clone, Default)]
|
||||
pub struct SyntaxTheme {
|
||||
pub highlights: Vec<(String, HighlightStyle)>,
|
||||
pub inlay_style: HighlightStyle,
|
||||
pub suggestion_style: HighlightStyle,
|
||||
}
|
||||
|
||||
impl SyntaxTheme {
|
||||
@@ -21,6 +23,8 @@ impl SyntaxTheme {
|
||||
)
|
||||
})
|
||||
.collect(),
|
||||
inlay_style: HighlightStyle::default(),
|
||||
suggestion_style: HighlightStyle::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ impl Theme {
|
||||
|
||||
/// Returns the [`SyntaxTheme`] for the theme.
|
||||
#[inline(always)]
|
||||
pub fn syntax(&self) -> &SyntaxTheme {
|
||||
pub fn syntax(&self) -> &Arc<SyntaxTheme> {
|
||||
&self.styles.syntax
|
||||
}
|
||||
|
||||
@@ -98,4 +98,25 @@ impl Theme {
|
||||
pub fn syntax_color(&self, name: &str) -> Hsla {
|
||||
self.syntax().color(name)
|
||||
}
|
||||
|
||||
/// Returns the [`StatusColors`] for the theme.
|
||||
#[inline(always)]
|
||||
pub fn diagnostic_style(&self) -> DiagnosticStyle {
|
||||
DiagnosticStyle {
|
||||
error: self.status().error,
|
||||
warning: self.status().warning,
|
||||
info: self.status().info,
|
||||
hint: self.status().info,
|
||||
ignored: self.status().ignored,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct DiagnosticStyle {
|
||||
pub error: Hsla,
|
||||
pub warning: Hsla,
|
||||
pub info: Hsla,
|
||||
pub hint: Hsla,
|
||||
pub ignored: Hsla,
|
||||
}
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// This file was generated by the `theme_importer`.
|
||||
// Be careful when modifying it by hand.
|
||||
|
||||
use gpui::rgba;
|
||||
|
||||
use crate::{
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// This file was generated by the `theme_importer`.
|
||||
// Be careful when modifying it by hand.
|
||||
|
||||
use gpui::rgba;
|
||||
|
||||
use crate::{
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// This file was generated by the `theme_importer`.
|
||||
// Be careful when modifying it by hand.
|
||||
|
||||
use gpui::rgba;
|
||||
|
||||
use crate::{
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// This file was generated by the `theme_importer`.
|
||||
// Be careful when modifying it by hand.
|
||||
|
||||
use gpui::rgba;
|
||||
|
||||
use crate::{
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// This file was generated by the `theme_importer`.
|
||||
// Be careful when modifying it by hand.
|
||||
|
||||
mod andromeda;
|
||||
mod ayu;
|
||||
mod dracula;
|
||||
@@ -24,7 +27,7 @@ pub use synthwave_84::*;
|
||||
|
||||
use crate::UserThemeFamily;
|
||||
|
||||
pub(crate) fn all_imported_themes() -> Vec<UserThemeFamily> {
|
||||
pub(crate) fn all_user_themes() -> Vec<UserThemeFamily> {
|
||||
vec![
|
||||
rose_pine(),
|
||||
night_owl(),
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// This file was generated by the `theme_importer`.
|
||||
// Be careful when modifying it by hand.
|
||||
|
||||
use gpui::rgba;
|
||||
|
||||
use crate::{
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// This file was generated by the `theme_importer`.
|
||||
// Be careful when modifying it by hand.
|
||||
|
||||
use gpui::rgba;
|
||||
|
||||
use crate::{
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// This file was generated by the `theme_importer`.
|
||||
// Be careful when modifying it by hand.
|
||||
|
||||
use gpui::rgba;
|
||||
|
||||
use crate::{
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// This file was generated by the `theme_importer`.
|
||||
// Be careful when modifying it by hand.
|
||||
|
||||
use gpui::rgba;
|
||||
|
||||
use crate::{
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// This file was generated by the `theme_importer`.
|
||||
// Be careful when modifying it by hand.
|
||||
|
||||
use gpui::rgba;
|
||||
|
||||
use crate::{
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// This file was generated by the `theme_importer`.
|
||||
// Be careful when modifying it by hand.
|
||||
|
||||
use gpui::rgba;
|
||||
|
||||
use crate::{
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// This file was generated by the `theme_importer`.
|
||||
// Be careful when modifying it by hand.
|
||||
|
||||
use gpui::rgba;
|
||||
|
||||
use crate::{
|
||||
|
||||
Reference in New Issue
Block a user