Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Replace `GitStatusColors` with `StatusColors` (#3268)
Marshall Bowersb6766ba39a63
diff --git a/crates/storybook2/src/stories/focus.rs b/crates/storybook2/src/stories/focus.rsindex 57f98698597..d2d565aadaf 100644--- a/crates/storybook2/src/stories/focus.rs+++ b/crates/storybook2/src/stories/focus.rs@@ -25,12 +25,12 @@ impl Render for FocusStory {fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> Self::Element {let theme = cx.theme();- let color_1 = theme.styles.git.created;- let color_2 = theme.styles.git.modified;- let color_3 = theme.styles.git.deleted;- let color_4 = theme.styles.git.conflict;- let color_5 = theme.styles.git.ignored;- let color_6 = theme.styles.git.renamed;+ let color_1 = theme.status().created;+ let color_2 = theme.status().modified;+ let color_3 = theme.status().deleted;+ let color_4 = theme.status().conflict;+ let color_5 = theme.status().ignored;+ let color_6 = theme.status().renamed;let child_1 = cx.focus_handle();let child_2 = cx.focus_handle();diff --git a/crates/storybook2/src/stories/scroll.rs b/crates/storybook2/src/stories/scroll.rsindex cdb48603e09..744d0206f9a 100644--- a/crates/storybook2/src/stories/scroll.rs+++ b/crates/storybook2/src/stories/scroll.rs@@ -17,8 +17,8 @@ impl Render for ScrollStory {fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> Self::Element {let theme = cx.theme();- let color_1 = theme.styles.git.created;- let color_2 = theme.styles.git.modified;+ let color_1 = theme.status().created;+ let color_2 = theme.status().modified;div().id("parent")diff --git a/crates/theme2/src/colors.rs b/crates/theme2/src/colors.rsindex 8e3db635378..83af983d044 100644--- a/crates/theme2/src/colors.rs+++ b/crates/theme2/src/colors.rs@@ -29,17 +29,6 @@ pub struct StatusColors {pub warning: Hsla,}-#[derive(Refineable, Clone, Debug)]-#[refineable(debug)]-pub struct GitStatusColors {- pub conflict: Hsla,- pub created: Hsla,- pub deleted: Hsla,- pub ignored: Hsla,- pub modified: Hsla,- pub renamed: Hsla,-}-#[derive(Refineable, Clone, Debug)]#[refineable(debug, deserialize)]pub struct ThemeColors {@@ -260,7 +249,6 @@ pub struct ThemeStyles {#[refineable]pub colors: ThemeColors,pub status: StatusColors,- pub git: GitStatusColors,pub player: PlayerColors,pub syntax: Arc<SyntaxTheme>,}diff --git a/crates/theme2/src/default_colors.rs b/crates/theme2/src/default_colors.rsindex 3a626205f92..ec57538e8f7 100644--- a/crates/theme2/src/default_colors.rs+++ b/crates/theme2/src/default_colors.rs@@ -2,12 +2,10 @@ use std::num::ParseIntError;use gpui::{hsla, Hsla, Rgba};-use crate::{- colors::{GitStatusColors, StatusColors, SystemColors, ThemeColors},- scale::{ColorScaleSet, ColorScales},- syntax::SyntaxTheme,- ColorScale, PlayerColor, PlayerColors,-};+use crate::colors::{StatusColors, SystemColors, ThemeColors};+use crate::scale::{ColorScaleSet, ColorScales};+use crate::syntax::SyntaxTheme;+use crate::{ColorScale, PlayerColor, PlayerColors};impl Default for PlayerColors {fn default() -> Self {@@ -136,19 +134,6 @@ impl Default for StatusColors {}}-impl Default for GitStatusColors {- fn default() -> Self {- Self {- conflict: orange().dark().step_9(),- created: grass().dark().step_9(),- deleted: red().dark().step_9(),- ignored: neutral().dark().step_9(),- modified: yellow().dark().step_9(),- renamed: blue().dark().step_9(),- }- }-}-impl SyntaxTheme {pub fn default_light() -> Self {Self {diff --git a/crates/theme2/src/default_theme.rs b/crates/theme2/src/default_theme.rsindex a0947e47c34..40fb7df7cfd 100644--- a/crates/theme2/src/default_theme.rs+++ b/crates/theme2/src/default_theme.rs@@ -1,7 +1,7 @@use std::sync::Arc;use crate::{- colors::{GitStatusColors, StatusColors, SystemColors, ThemeColors, ThemeStyles},+ colors::{StatusColors, SystemColors, ThemeColors, ThemeStyles},default_color_scales, Appearance, PlayerColors, SyntaxTheme, Theme, ThemeFamily,};@@ -14,7 +14,6 @@ fn zed_pro_daylight() -> Theme {system: SystemColors::default(),colors: ThemeColors::default_light(),status: StatusColors::default(),- git: GitStatusColors::default(),player: PlayerColors::default_light(),syntax: Arc::new(SyntaxTheme::default_light()),},@@ -30,7 +29,6 @@ pub(crate) fn zed_pro_moonlight() -> Theme {system: SystemColors::default(),colors: ThemeColors::default_dark(),status: StatusColors::default(),- git: GitStatusColors::default(),player: PlayerColors::default(),syntax: Arc::new(SyntaxTheme::default_dark()),},diff --git a/crates/theme2/src/registry.rs b/crates/theme2/src/registry.rsindex c6e195e757c..decec8b5dad 100644--- a/crates/theme2/src/registry.rs+++ b/crates/theme2/src/registry.rs@@ -6,8 +6,8 @@ use gpui::SharedString;use refineable::Refineable;use crate::{- zed_pro_family, Appearance, GitStatusColors, PlayerColors, StatusColors, SyntaxTheme,- SystemColors, Theme, ThemeColors, ThemeFamily, ThemeStyles, UserTheme, UserThemeFamily,+ zed_pro_family, Appearance, PlayerColors, StatusColors, SyntaxTheme, SystemColors, Theme,+ ThemeColors, ThemeFamily, ThemeStyles, UserTheme, UserThemeFamily,};pub struct ThemeRegistry {@@ -50,7 +50,6 @@ impl ThemeRegistry {system: SystemColors::default(),colors: theme_colors,status: StatusColors::default(),- git: GitStatusColors::default(),player: PlayerColors::default(),syntax: match user_theme.appearance {Appearance::Light => Arc::new(SyntaxTheme::default_light()),diff --git a/crates/theme2/src/theme2.rs b/crates/theme2/src/theme2.rsindex 9019eba07ad..28d12e2b43c 100644--- a/crates/theme2/src/theme2.rs+++ b/crates/theme2/src/theme2.rs@@ -65,6 +65,12 @@ pub struct Theme {}impl Theme {+ /// Returns the [`SystemColors`] for the theme.+ #[inline(always)]+ pub fn system(&self) -> &SystemColors {+ &self.styles.system+ }+/// Returns the [`ThemeColors`] for the theme.#[inline(always)]pub fn players(&self) -> &PlayerColors {@@ -89,19 +95,13 @@ impl Theme {&self.styles.status}- /// Returns the [`GitStatusColors`] for the theme.- #[inline(always)]- pub fn git(&self) -> &GitStatusColors {- &self.styles.git- }-/// Returns the color for the syntax node with the given name.#[inline(always)]pub fn syntax_color(&self, name: &str) -> Hsla {self.syntax().color(name)}- /// Returns the [`StatusColors`] for the theme.+ /// Returns the [`DiagnosticStyle`] for the theme.#[inline(always)]pub fn diagnostic_style(&self) -> DiagnosticStyle {DiagnosticStyle {diff --git a/crates/theme_importer/src/theme_printer.rs b/crates/theme_importer/src/theme_printer.rsindex 0f20a8d60f9..49caf7bfd0b 100644--- a/crates/theme_importer/src/theme_printer.rs+++ b/crates/theme_importer/src/theme_printer.rs@@ -2,8 +2,8 @@ use std::fmt::{self, Debug};use gpui::{Hsla, Rgba};use theme::{- Appearance, GitStatusColors, PlayerColor, PlayerColors, StatusColors, SyntaxTheme,- SystemColors, ThemeColorsRefinement, UserTheme, UserThemeFamily, UserThemeStylesRefinement,+ Appearance, PlayerColor, PlayerColors, StatusColors, SyntaxTheme, SystemColors,+ ThemeColorsRefinement, UserTheme, UserThemeFamily, UserThemeStylesRefinement,};struct RawSyntaxPrinter<'a>(&'a str);@@ -270,21 +270,6 @@ impl<'a> Debug for StatusColorsPrinter<'a> {}}-pub struct GitStatusColorsPrinter<'a>(&'a GitStatusColors);--impl<'a> Debug for GitStatusColorsPrinter<'a> {- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {- f.debug_struct("GitStatusColors")- .field("conflict", &HslaPrinter(self.0.conflict))- .field("created", &HslaPrinter(self.0.created))- .field("deleted", &HslaPrinter(self.0.deleted))- .field("ignored", &HslaPrinter(self.0.ignored))- .field("modified", &HslaPrinter(self.0.modified))- .field("renamed", &HslaPrinter(self.0.renamed))- .finish()- }-}-pub struct PlayerColorsPrinter<'a>(&'a PlayerColors);impl<'a> Debug for PlayerColorsPrinter<'a> {diff --git a/crates/ui2/src/prelude.rs b/crates/ui2/src/prelude.rsindex c942f0aa3b8..3f179210eb3 100644--- a/crates/ui2/src/prelude.rs+++ b/crates/ui2/src/prelude.rs@@ -46,12 +46,12 @@ pub enum GitStatus {impl GitStatus {pub fn hsla(&self, cx: &WindowContext) -> Hsla {match self {- Self::None => cx.theme().styles.system.transparent,- Self::Created => cx.theme().styles.git.created,- Self::Modified => cx.theme().styles.git.modified,- Self::Deleted => cx.theme().styles.git.deleted,- Self::Conflict => cx.theme().styles.git.conflict,- Self::Renamed => cx.theme().styles.git.renamed,+ Self::None => cx.theme().system().transparent,+ Self::Created => cx.theme().status().created,+ Self::Modified => cx.theme().status().modified,+ Self::Deleted => cx.theme().status().deleted,+ Self::Conflict => cx.theme().status().conflict,+ Self::Renamed => cx.theme().status().renamed,}}}