Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Remove references to `old_theme`
Marshall Bowers14d24a9ac6b6
diff --git a/crates/ui2/src/components/workspace.rs b/crates/ui2/src/components/workspace.rsindex fbb2c646688..af2485a7a9c 100644--- a/crates/ui2/src/components/workspace.rs+++ b/crates/ui2/src/components/workspace.rs@@ -3,8 +3,7 @@ use std::sync::Arc;use chrono::DateTime;use gpui2::{px, relative, rems, AppContext, Context, Size, View};-use crate::{- old_theme, static_livestream, user_settings_mut, v_stack, AssistantPanel, Button, ChatMessage,+use crate::{static_livestream, user_settings_mut, v_stack, AssistantPanel, Button, ChatMessage,ChatPanel, CollabPanel, EditorPane, FakeSettings, Label, LanguageSelector, Pane, PaneGroup,Panel, PanelAllowedSides, PanelSide, ProjectPanel, SettingValue, SplitDirection, StatusBar,Terminal, TitleBar, Toast, ToastOrigin,@@ -179,7 +178,7 @@ impl Workspace {}pub fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Component<Self> {- let theme = old_theme(cx).clone();+ let theme = theme(cx);// HACK: This should happen inside of `debug_toggle_user_settings`, but// we don't have `cx.global::<FakeSettings>()` in event handlers at the moment.@@ -216,8 +215,8 @@ impl Workspace {.gap_0().justify_start().items_start()- .text_color(theme.lowest.base.default.foreground)- .bg(theme.lowest.base.default.background)+ .text_color(theme.text)+ .bg(theme.background).child(self.title_bar.clone()).child(div()@@ -228,7 +227,7 @@ impl Workspace {.overflow_hidden().border_t().border_b()- .border_color(theme.lowest.base.default.border)+ .border_color(theme.border).children(Some(Panel::new("project-panel-outer", cx)diff --git a/crates/ui2/src/elements/icon.rs b/crates/ui2/src/elements/icon.rsindex b47e4c66085..ef364422968 100644--- a/crates/ui2/src/elements/icon.rs+++ b/crates/ui2/src/elements/icon.rs@@ -2,7 +2,6 @@ use gpui2::{svg, Hsla};use strum::EnumIter;use crate::prelude::*;-use crate::theme::old_theme;#[derive(Default, PartialEq, Copy, Clone)]pub enum IconSize {@@ -27,17 +26,17 @@ pub enum IconColor {impl IconColor {pub fn color(self, cx: &WindowContext) -> Hsla {- let theme = old_theme(cx);+ let theme = theme(cx);match self {- IconColor::Default => theme.lowest.base.default.foreground,- IconColor::Muted => theme.lowest.variant.default.foreground,- IconColor::Disabled => theme.lowest.base.disabled.foreground,- IconColor::Placeholder => theme.lowest.base.disabled.foreground,- IconColor::Accent => theme.lowest.accent.default.foreground,- IconColor::Error => theme.lowest.negative.default.foreground,- IconColor::Warning => theme.lowest.warning.default.foreground,- IconColor::Success => theme.lowest.positive.default.foreground,- IconColor::Info => theme.lowest.accent.default.foreground,+ IconColor::Default => gpui2::red(),+ IconColor::Muted => gpui2::red(),+ IconColor::Disabled => gpui2::red(),+ IconColor::Placeholder => gpui2::red(),+ IconColor::Accent => gpui2::red(),+ IconColor::Error => gpui2::red(),+ IconColor::Warning => gpui2::red(),+ IconColor::Success => gpui2::red(),+ IconColor::Info => gpui2::red()}}}diff --git a/crates/ui2/src/elements/label.rs b/crates/ui2/src/elements/label.rsindex f4014d5922d..6c97819eeb7 100644--- a/crates/ui2/src/elements/label.rs+++ b/crates/ui2/src/elements/label.rs@@ -2,8 +2,6 @@ use gpui2::{relative, Hsla, WindowContext};use smallvec::SmallVec;use crate::prelude::*;-use crate::theme::old_theme;-#[derive(Default, PartialEq, Copy, Clone)]pub enum LabelColor {#[default]@@ -21,19 +19,17 @@ pub enum LabelColor {impl LabelColor {pub fn hsla(&self, cx: &WindowContext) -> Hsla {let theme = theme(cx);- // TODO: Remove- let old_theme = old_theme(cx);match self {Self::Default => theme.text,Self::Muted => theme.text_muted,- Self::Created => old_theme.middle.positive.default.foreground,- Self::Modified => old_theme.middle.warning.default.foreground,- Self::Deleted => old_theme.middle.negative.default.foreground,+ Self::Created => gpui2::red(),+ Self::Modified => gpui2::red(),+ Self::Deleted => gpui2::red(),Self::Disabled => theme.text_disabled,- Self::Hidden => old_theme.middle.variant.default.foreground,+ Self::Hidden => gpui2::red(),Self::Placeholder => theme.text_placeholder,- Self::Accent => old_theme.middle.accent.default.foreground,+ Self::Accent => gpui2::red(),}}}diff --git a/crates/ui2/src/prelude.rs b/crates/ui2/src/prelude.rsindex 95cd6ffa6dc..5d701fc5d7e 100644--- a/crates/ui2/src/prelude.rs+++ b/crates/ui2/src/prelude.rs@@ -5,7 +5,7 @@ pub use gpui2::{pub use crate::elevation::*;use crate::settings::user_settings;-pub use crate::{old_theme, theme, ButtonVariant};+pub use crate::{theme, ButtonVariant};use gpui2::{rems, Hsla, Rems};use strum::EnumIter;diff --git a/crates/ui2/src/theme.rs b/crates/ui2/src/theme.rsindex f160a24da37..98c93f9bddb 100644--- a/crates/ui2/src/theme.rs+++ b/crates/ui2/src/theme.rs@@ -1,4 +1,4 @@-use gpui2::{AppContext, Hsla, Result, WindowContext};+use gpui2::{AppContext, Hsla, Result};use serde::{de::Visitor, Deserialize, Deserializer};use std::collections::HashMap;use std::fmt;@@ -129,10 +129,6 @@ wheredeserializer.deserialize_map(SyntaxVisitor)}-pub fn old_theme(cx: &WindowContext) -> Arc<Theme> {- Arc::new(cx.global::<Theme>().clone())-}-pub fn theme(cx: &AppContext) -> Arc<theme2::Theme> {theme2::active_theme(cx).clone()}