Remove references to old_theme

This commit is contained in:
Marshall Bowers 2023-10-30 14:36:49 -04:00
parent 7bacdefa2e
commit 14d24a9ac6
5 changed files with 22 additions and 32 deletions

View file

@ -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)

View file

@ -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()
}
}
}

View file

@ -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(),
}
}
}

View file

@ -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;

View file

@ -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 @@ where
deserializer.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()
}