Replace GitStatusColors with StatusColors (#3268)

This PR removes `GitStatusColors` in favor of just using `StatusColors`
instead.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers
2023-11-08 11:32:32 -05:00
committed by GitHub
parent 9e5a4ea6c4
commit b6766ba39a
9 changed files with 30 additions and 75 deletions
-12
View File
@@ -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>,
}
+4 -19
View File
@@ -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 {
+1 -3
View File
@@ -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()),
},
+2 -3
View File
@@ -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()),
+7 -7
View File
@@ -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 {