Remove ThemeColor
in favor of theme2::Theme
This commit is contained in:
parent
bb3f59252e
commit
e1032c5341
42 changed files with 225 additions and 391 deletions
|
@ -27,8 +27,6 @@ impl<S: 'static + Send + Sync> AssistantPanel<S> {
|
|||
}
|
||||
|
||||
fn render(&mut self, view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
|
||||
Panel::new(self.id.clone(), cx)
|
||||
.children(vec![div()
|
||||
.flex()
|
||||
|
|
|
@ -26,8 +26,9 @@ impl<S: 'static + Send + Sync> Breadcrumb<S> {
|
|||
}
|
||||
|
||||
fn render_separator(&self, cx: &WindowContext) -> Div<S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
div().child(" › ").text_color(color.text_muted)
|
||||
let theme = theme(cx);
|
||||
|
||||
div().child(" › ").text_color(theme.text_muted)
|
||||
}
|
||||
|
||||
fn render(
|
||||
|
@ -35,7 +36,7 @@ impl<S: 'static + Send + Sync> Breadcrumb<S> {
|
|||
view_state: &mut S,
|
||||
cx: &mut ViewContext<S>,
|
||||
) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
|
||||
let symbols_len = self.symbols.len();
|
||||
|
||||
|
@ -43,10 +44,10 @@ impl<S: 'static + Send + Sync> Breadcrumb<S> {
|
|||
.id("breadcrumb")
|
||||
.px_1()
|
||||
.text_sm()
|
||||
.text_color(color.text_muted)
|
||||
.text_color(theme.text_muted)
|
||||
.rounded_md()
|
||||
.hover(|style| style.bg(color.ghost_element_hover))
|
||||
.active(|style| style.bg(color.ghost_element_active))
|
||||
.hover(|style| style.bg(theme.ghost_element_hover))
|
||||
.active(|style| style.bg(theme.ghost_element_active))
|
||||
.child(self.path.clone().to_str().unwrap().to_string())
|
||||
.child(if !self.symbols.is_empty() {
|
||||
self.render_separator(cx)
|
||||
|
@ -106,7 +107,7 @@ mod stories {
|
|||
view_state: &mut S,
|
||||
cx: &mut ViewContext<S>,
|
||||
) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
|
||||
Story::container(cx)
|
||||
.child(Story::title_for::<_, Breadcrumb<S>>(cx))
|
||||
|
@ -117,21 +118,21 @@ mod stories {
|
|||
Symbol(vec![
|
||||
HighlightedText {
|
||||
text: "impl ".to_string(),
|
||||
color: color.syntax.keyword,
|
||||
color: theme.syntax.keyword,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "BreadcrumbStory".to_string(),
|
||||
color: color.syntax.function,
|
||||
color: theme.syntax.function,
|
||||
},
|
||||
]),
|
||||
Symbol(vec![
|
||||
HighlightedText {
|
||||
text: "fn ".to_string(),
|
||||
color: color.syntax.keyword,
|
||||
color: theme.syntax.keyword,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "render".to_string(),
|
||||
color: color.syntax.function,
|
||||
color: theme.syntax.function,
|
||||
},
|
||||
]),
|
||||
],
|
||||
|
|
|
@ -159,18 +159,18 @@ impl<S: 'static + Send + Sync + Clone> Buffer<S> {
|
|||
}
|
||||
|
||||
fn render_row(row: BufferRow, cx: &WindowContext) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
|
||||
let line_background = if row.current {
|
||||
color.editor_active_line
|
||||
theme.editor_active_line
|
||||
} else {
|
||||
color.transparent
|
||||
theme.transparent
|
||||
};
|
||||
|
||||
let line_number_color = if row.current {
|
||||
color.text
|
||||
theme.text
|
||||
} else {
|
||||
color.syntax.comment
|
||||
theme.syntax.comment
|
||||
};
|
||||
|
||||
h_stack()
|
||||
|
@ -220,14 +220,14 @@ impl<S: 'static + Send + Sync + Clone> Buffer<S> {
|
|||
}
|
||||
|
||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
let rows = self.render_rows(cx);
|
||||
|
||||
v_stack()
|
||||
.flex_1()
|
||||
.w_full()
|
||||
.h_full()
|
||||
.bg(color.editor)
|
||||
.bg(theme.editor)
|
||||
.children(rows)
|
||||
}
|
||||
}
|
||||
|
@ -263,7 +263,7 @@ mod stories {
|
|||
_view: &mut S,
|
||||
cx: &mut ViewContext<S>,
|
||||
) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
|
||||
Story::container(cx)
|
||||
.child(Story::title_for::<_, Buffer<S>>(cx))
|
||||
|
@ -274,14 +274,14 @@ mod stories {
|
|||
div()
|
||||
.w(rems(64.))
|
||||
.h_96()
|
||||
.child(hello_world_rust_buffer_example(&color)),
|
||||
.child(hello_world_rust_buffer_example(&theme)),
|
||||
)
|
||||
.child(Story::label(cx, "Hello World (Rust) with Status"))
|
||||
.child(
|
||||
div()
|
||||
.w(rems(64.))
|
||||
.h_96()
|
||||
.child(hello_world_rust_buffer_with_status_example(&color)),
|
||||
.child(hello_world_rust_buffer_with_status_example(&theme)),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,15 +22,13 @@ impl BufferSearch {
|
|||
}
|
||||
|
||||
pub fn view(cx: &mut WindowContext) -> View<Self> {
|
||||
let color = ThemeColor::new(cx);
|
||||
|
||||
view(cx.entity(|cx| Self::new()), Self::render)
|
||||
}
|
||||
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element<ViewState = Self> {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
|
||||
h_stack().bg(color.toolbar).p_2().child(
|
||||
h_stack().bg(theme.toolbar).p_2().child(
|
||||
h_stack().child(Input::new("Search")).child(
|
||||
IconButton::<Self>::new("replace", Icon::Replace)
|
||||
.when(self.is_replace_open, |this| this.color(IconColor::Accent))
|
||||
|
|
|
@ -3,7 +3,6 @@ use crate::{
|
|||
static_collab_panel_channels, static_collab_panel_current_call, v_stack, Icon, List,
|
||||
ListHeader, ToggleState,
|
||||
};
|
||||
use gpui2::{img, svg, SharedString};
|
||||
use std::marker::PhantomData;
|
||||
|
||||
#[derive(Element)]
|
||||
|
@ -21,19 +20,19 @@ impl<S: 'static + Send + Sync> CollabPanel<S> {
|
|||
}
|
||||
|
||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
|
||||
v_stack()
|
||||
.id(self.id.clone())
|
||||
.h_full()
|
||||
.bg(color.surface)
|
||||
.bg(theme.surface)
|
||||
.child(
|
||||
v_stack()
|
||||
.id("crdb")
|
||||
.w_full()
|
||||
.overflow_y_scroll()
|
||||
.child(
|
||||
div().pb_1().border_color(color.border).border_b().child(
|
||||
div().pb_1().border_color(theme.border).border_b().child(
|
||||
List::new(static_collab_panel_current_call())
|
||||
.header(
|
||||
ListHeader::new("CRDB")
|
||||
|
@ -77,79 +76,17 @@ impl<S: 'static + Send + Sync> CollabPanel<S> {
|
|||
.h_7()
|
||||
.px_2()
|
||||
.border_t()
|
||||
.border_color(color.border)
|
||||
.border_color(theme.border)
|
||||
.flex()
|
||||
.items_center()
|
||||
.child(
|
||||
div()
|
||||
.text_sm()
|
||||
.text_color(color.text_placeholder)
|
||||
.text_color(theme.text_placeholder)
|
||||
.child("Find..."),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
fn list_section_header(
|
||||
&self,
|
||||
label: impl Into<SharedString>,
|
||||
expanded: bool,
|
||||
cx: &WindowContext,
|
||||
) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
div()
|
||||
.h_7()
|
||||
.px_2()
|
||||
.flex()
|
||||
.justify_between()
|
||||
.items_center()
|
||||
.child(div().flex().gap_1().text_sm().child(label.into()))
|
||||
.child(
|
||||
div().flex().h_full().gap_1().items_center().child(
|
||||
svg()
|
||||
.path(if expanded {
|
||||
"icons/caret_down.svg"
|
||||
} else {
|
||||
"icons/caret_up.svg"
|
||||
})
|
||||
.w_3p5()
|
||||
.h_3p5()
|
||||
.text_color(color.icon_muted),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
fn list_item(
|
||||
&self,
|
||||
avatar_uri: impl Into<SharedString>,
|
||||
label: impl Into<SharedString>,
|
||||
cx: &WindowContext,
|
||||
) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
|
||||
div()
|
||||
.id("list_item")
|
||||
.h_7()
|
||||
.px_2()
|
||||
.flex()
|
||||
.items_center()
|
||||
.hover(|style| style.bg(color.ghost_element_hover))
|
||||
.active(|style| style.bg(color.ghost_element_active))
|
||||
.child(
|
||||
div()
|
||||
.flex()
|
||||
.items_center()
|
||||
.gap_1()
|
||||
.text_sm()
|
||||
.child(
|
||||
img()
|
||||
.uri(avatar_uri)
|
||||
.size_3p5()
|
||||
.rounded_full()
|
||||
.bg(color.image_fallback_background),
|
||||
)
|
||||
.child(label.into()),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "stories")]
|
||||
|
|
|
@ -43,13 +43,13 @@ impl<S: 'static + Send + Sync> ContextMenu<S> {
|
|||
}
|
||||
}
|
||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
|
||||
v_stack()
|
||||
.flex()
|
||||
.bg(color.elevated_surface)
|
||||
.bg(theme.elevated_surface)
|
||||
.border()
|
||||
.border_color(color.border)
|
||||
.border_color(theme.border)
|
||||
.child(
|
||||
List::new(
|
||||
self.items
|
||||
|
|
|
@ -17,8 +17,6 @@ impl<S: 'static + Send + Sync + Clone> CopilotModal<S> {
|
|||
}
|
||||
|
||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
|
||||
div().id(self.id.clone()).child(
|
||||
Modal::new("some-id")
|
||||
.title("Connect Copilot to Zed")
|
||||
|
|
|
@ -43,8 +43,6 @@ impl EditorPane {
|
|||
}
|
||||
|
||||
pub fn view(cx: &mut WindowContext) -> View<Self> {
|
||||
let color = ThemeColor::new(cx);
|
||||
|
||||
view(
|
||||
cx.entity(|cx| hello_world_rust_editor_with_status_example(cx)),
|
||||
Self::render,
|
||||
|
|
|
@ -18,7 +18,6 @@ impl<S: 'static + Send + Sync> Facepile<S> {
|
|||
}
|
||||
|
||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
let player_count = self.players.len();
|
||||
let player_list = self.players.iter().enumerate().map(|(ix, player)| {
|
||||
let isnt_last = ix < player_count - 1;
|
||||
|
|
|
@ -69,7 +69,7 @@ impl<S: 'static + Send + Sync> IconButton<S> {
|
|||
}
|
||||
|
||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
|
||||
let icon_color = match (self.state, self.color) {
|
||||
(InteractionState::Disabled, _) => IconColor::Disabled,
|
||||
|
@ -78,14 +78,14 @@ impl<S: 'static + Send + Sync> IconButton<S> {
|
|||
|
||||
let (bg_color, bg_hover_color, bg_active_color) = match self.variant {
|
||||
ButtonVariant::Filled => (
|
||||
color.filled_element,
|
||||
color.filled_element_hover,
|
||||
color.filled_element_active,
|
||||
theme.filled_element,
|
||||
theme.filled_element_hover,
|
||||
theme.filled_element_active,
|
||||
),
|
||||
ButtonVariant::Ghost => (
|
||||
color.ghost_element,
|
||||
color.ghost_element_hover,
|
||||
color.ghost_element_active,
|
||||
theme.ghost_element,
|
||||
theme.ghost_element_hover,
|
||||
theme.ghost_element_active,
|
||||
),
|
||||
};
|
||||
|
||||
|
|
|
@ -69,15 +69,15 @@ impl<S: 'static + Send + Sync> Key<S> {
|
|||
}
|
||||
|
||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
|
||||
div()
|
||||
.px_2()
|
||||
.py_0()
|
||||
.rounded_md()
|
||||
.text_sm()
|
||||
.text_color(color.text)
|
||||
.bg(color.filled_element)
|
||||
.text_color(theme.text)
|
||||
.bg(theme.filled_element)
|
||||
.child(self.key.clone())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ impl<S: 'static + Send + Sync> ListHeader<S> {
|
|||
}
|
||||
|
||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
|
||||
let is_toggleable = self.toggleable != Toggleable::NotToggleable;
|
||||
let is_toggled = self.toggleable.is_toggled();
|
||||
|
@ -103,9 +103,9 @@ impl<S: 'static + Send + Sync> ListHeader<S> {
|
|||
h_stack()
|
||||
.flex_1()
|
||||
.w_full()
|
||||
.bg(color.surface)
|
||||
.bg(theme.surface)
|
||||
.when(self.state == InteractionState::Focused, |this| {
|
||||
this.border().border_color(color.border_focused)
|
||||
this.border().border_color(theme.border_focused)
|
||||
})
|
||||
.relative()
|
||||
.child(
|
||||
|
@ -158,8 +158,6 @@ impl<S: 'static + Send + Sync> ListSubHeader<S> {
|
|||
}
|
||||
|
||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
|
||||
h_stack().flex_1().w_full().relative().py_1().child(
|
||||
div()
|
||||
.h_6()
|
||||
|
@ -350,8 +348,6 @@ impl<S: 'static + Send + Sync> ListEntry<S> {
|
|||
&mut self,
|
||||
cx: &mut ViewContext<S>,
|
||||
) -> Option<impl Element<ViewState = S>> {
|
||||
let color = ThemeColor::new(cx);
|
||||
|
||||
let disclosure_control_icon = if let Some(ToggleState::Toggled) = self.toggle {
|
||||
IconElement::new(Icon::ChevronDown)
|
||||
} else {
|
||||
|
@ -372,9 +368,8 @@ impl<S: 'static + Send + Sync> ListEntry<S> {
|
|||
}
|
||||
|
||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
let color = ThemeColor::new(cx);
|
||||
let settings = user_settings(cx);
|
||||
let theme = theme(cx);
|
||||
|
||||
let left_content = match self.left_content.clone() {
|
||||
Some(LeftContent::Icon(i)) => Some(
|
||||
|
@ -396,9 +391,9 @@ impl<S: 'static + Send + Sync> ListEntry<S> {
|
|||
div()
|
||||
.relative()
|
||||
.group("")
|
||||
.bg(color.surface)
|
||||
.bg(theme.surface)
|
||||
.when(self.state == InteractionState::Focused, |this| {
|
||||
this.border().border_color(color.border_focused)
|
||||
this.border().border_color(theme.border_focused)
|
||||
})
|
||||
.child(
|
||||
sized_item
|
||||
|
@ -410,11 +405,11 @@ impl<S: 'static + Send + Sync> ListEntry<S> {
|
|||
.h_full()
|
||||
.flex()
|
||||
.justify_center()
|
||||
.group_hover("", |style| style.bg(color.border_focused))
|
||||
.group_hover("", |style| style.bg(theme.border_focused))
|
||||
.child(
|
||||
h_stack()
|
||||
.child(div().w_px().h_full())
|
||||
.child(div().w_px().h_full().bg(color.border)),
|
||||
.child(div().w_px().h_full().bg(theme.border)),
|
||||
)
|
||||
}))
|
||||
.flex()
|
||||
|
@ -483,19 +478,19 @@ impl<S: 'static + Send + Sync> ListDetailsEntry<S> {
|
|||
}
|
||||
|
||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
let settings = user_settings(cx);
|
||||
|
||||
let (item_bg, item_bg_hover, item_bg_active) = match self.seen {
|
||||
true => (
|
||||
color.ghost_element,
|
||||
color.ghost_element_hover,
|
||||
color.ghost_element_active,
|
||||
theme.ghost_element,
|
||||
theme.ghost_element_hover,
|
||||
theme.ghost_element_active,
|
||||
),
|
||||
false => (
|
||||
color.filled_element,
|
||||
color.filled_element_hover,
|
||||
color.filled_element_active,
|
||||
theme.filled_element,
|
||||
theme.filled_element_hover,
|
||||
theme.filled_element_active,
|
||||
),
|
||||
};
|
||||
|
||||
|
@ -540,9 +535,9 @@ impl<S: 'static + Send + Sync> ListSeparator<S> {
|
|||
}
|
||||
|
||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
|
||||
div().h_px().w_full().bg(color.border)
|
||||
div().h_px().w_full().bg(theme.border)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -580,7 +575,6 @@ impl<S: 'static + Send + Sync> List<S> {
|
|||
}
|
||||
|
||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
let is_toggleable = self.toggleable != Toggleable::NotToggleable;
|
||||
let is_toggled = Toggleable::is_toggled(&self.toggleable);
|
||||
|
||||
|
|
|
@ -43,22 +43,22 @@ impl<S: 'static + Send + Sync> Modal<S> {
|
|||
}
|
||||
|
||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
|
||||
v_stack()
|
||||
.id(self.id.clone())
|
||||
.w_96()
|
||||
// .rounded_xl()
|
||||
.bg(color.background)
|
||||
.bg(theme.background)
|
||||
.border()
|
||||
.border_color(color.border)
|
||||
.border_color(theme.border)
|
||||
.shadow_2xl()
|
||||
.child(
|
||||
h_stack()
|
||||
.justify_between()
|
||||
.p_1()
|
||||
.border_b()
|
||||
.border_color(color.border)
|
||||
.border_color(theme.border)
|
||||
.child(div().children(self.title.clone().map(|t| Label::new(t))))
|
||||
.child(IconButton::new("close", Icon::Close)),
|
||||
)
|
||||
|
@ -69,7 +69,7 @@ impl<S: 'static + Send + Sync> Modal<S> {
|
|||
this.child(
|
||||
h_stack()
|
||||
.border_t()
|
||||
.border_color(color.border)
|
||||
.border_color(theme.border)
|
||||
.p_1()
|
||||
.justify_end()
|
||||
.children(self.secondary_action.take())
|
||||
|
|
|
@ -18,7 +18,7 @@ impl<S: 'static + Send + Sync + Clone> MultiBuffer<S> {
|
|||
}
|
||||
|
||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
|
||||
v_stack()
|
||||
.w_full()
|
||||
|
@ -32,7 +32,7 @@ impl<S: 'static + Send + Sync + Clone> MultiBuffer<S> {
|
|||
.items_center()
|
||||
.justify_between()
|
||||
.p_4()
|
||||
.bg(color.editor_subheader)
|
||||
.bg(theme.editor_subheader)
|
||||
.child(Label::new("main.rs"))
|
||||
.child(IconButton::new("arrow_up_right", Icon::ArrowUpRight)),
|
||||
)
|
||||
|
@ -67,17 +67,17 @@ mod stories {
|
|||
_view: &mut S,
|
||||
cx: &mut ViewContext<S>,
|
||||
) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
|
||||
Story::container(cx)
|
||||
.child(Story::title_for::<_, MultiBuffer<S>>(cx))
|
||||
.child(Story::label(cx, "Default"))
|
||||
.child(MultiBuffer::new(vec![
|
||||
hello_world_rust_buffer_example(&color),
|
||||
hello_world_rust_buffer_example(&color),
|
||||
hello_world_rust_buffer_example(&color),
|
||||
hello_world_rust_buffer_example(&color),
|
||||
hello_world_rust_buffer_example(&color),
|
||||
hello_world_rust_buffer_example(&theme),
|
||||
hello_world_rust_buffer_example(&theme),
|
||||
hello_world_rust_buffer_example(&theme),
|
||||
hello_world_rust_buffer_example(&theme),
|
||||
hello_world_rust_buffer_example(&theme),
|
||||
]))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ impl<S: 'static + Send + Sync + Clone> NotificationToast<S> {
|
|||
}
|
||||
|
||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
|
||||
h_stack()
|
||||
.z_index(5)
|
||||
|
@ -42,7 +42,7 @@ impl<S: 'static + Send + Sync + Clone> NotificationToast<S> {
|
|||
.px_1p5()
|
||||
.rounded_lg()
|
||||
.shadow_md()
|
||||
.bg(color.elevated_surface)
|
||||
.bg(theme.elevated_surface)
|
||||
.child(div().size_full().child(self.label.clone()))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ impl<S: 'static + Send + Sync> NotificationsPanel<S> {
|
|||
}
|
||||
|
||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
|
||||
div()
|
||||
.id(self.id.clone())
|
||||
|
@ -26,7 +26,7 @@ impl<S: 'static + Send + Sync> NotificationsPanel<S> {
|
|||
.flex_col()
|
||||
.w_full()
|
||||
.h_full()
|
||||
.bg(color.surface)
|
||||
.bg(theme.surface)
|
||||
.child(
|
||||
div()
|
||||
.id("header")
|
||||
|
|
|
@ -47,22 +47,22 @@ impl<S: 'static + Send + Sync> Palette<S> {
|
|||
}
|
||||
|
||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
|
||||
v_stack()
|
||||
.id(self.id.clone())
|
||||
.w_96()
|
||||
.rounded_lg()
|
||||
.bg(color.elevated_surface)
|
||||
.bg(theme.elevated_surface)
|
||||
.border()
|
||||
.border_color(color.border)
|
||||
.border_color(theme.border)
|
||||
.child(
|
||||
v_stack()
|
||||
.gap_px()
|
||||
.child(v_stack().py_0p5().px_1().child(div().px_2().py_0p5().child(
|
||||
Label::new(self.input_placeholder.clone()).color(LabelColor::Placeholder),
|
||||
)))
|
||||
.child(div().h_px().w_full().bg(color.filled_element))
|
||||
.child(div().h_px().w_full().bg(theme.filled_element))
|
||||
.child(
|
||||
v_stack()
|
||||
.id("items")
|
||||
|
@ -92,8 +92,8 @@ impl<S: 'static + Send + Sync> Palette<S> {
|
|||
.px_2()
|
||||
.py_0p5()
|
||||
.rounded_lg()
|
||||
.hover(|style| style.bg(color.ghost_element_hover))
|
||||
.active(|style| style.bg(color.ghost_element_active))
|
||||
.hover(|style| style.bg(theme.ghost_element_hover))
|
||||
.active(|style| style.bg(theme.ghost_element_active))
|
||||
.child(item)
|
||||
})),
|
||||
),
|
||||
|
@ -136,8 +136,6 @@ impl<S: 'static + Send + Sync> PaletteItem<S> {
|
|||
}
|
||||
|
||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
|
||||
div()
|
||||
.flex()
|
||||
.flex_row()
|
||||
|
|
|
@ -97,7 +97,7 @@ impl<S: 'static + Send + Sync> Panel<S> {
|
|||
}
|
||||
|
||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
|
||||
let current_size = self.width.unwrap_or(self.initial_width);
|
||||
|
||||
|
@ -115,8 +115,8 @@ impl<S: 'static + Send + Sync> Panel<S> {
|
|||
.when(self.current_side == PanelSide::Bottom, |this| {
|
||||
this.border_b().w_full().h(current_size)
|
||||
})
|
||||
.bg(color.surface)
|
||||
.border_color(color.border)
|
||||
.bg(theme.surface)
|
||||
.border_color(theme.border)
|
||||
.children(self.children.drain(..))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,8 +41,6 @@ impl<S: 'static + Send + Sync> Pane<S> {
|
|||
}
|
||||
|
||||
fn render(&mut self, view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
|
||||
div()
|
||||
.id(self.id.clone())
|
||||
.flex()
|
||||
|
@ -100,7 +98,7 @@ impl<S: 'static + Send + Sync> PaneGroup<S> {
|
|||
}
|
||||
|
||||
fn render(&mut self, view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
|
||||
if !self.panes.is_empty() {
|
||||
let el = div()
|
||||
|
@ -125,7 +123,7 @@ impl<S: 'static + Send + Sync> PaneGroup<S> {
|
|||
.gap_px()
|
||||
.w_full()
|
||||
.h_full()
|
||||
.bg(color.editor)
|
||||
.bg(theme.editor)
|
||||
.children(self.groups.iter_mut().map(|group| group.render(view, cx)));
|
||||
|
||||
if self.split_direction == SplitDirection::Horizontal {
|
||||
|
|
|
@ -18,7 +18,7 @@ impl<S: 'static + Send + Sync> PlayerStack<S> {
|
|||
}
|
||||
|
||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
let player = self.player_with_call_status.get_player();
|
||||
self.player_with_call_status.get_call_status();
|
||||
|
||||
|
@ -54,7 +54,7 @@ impl<S: 'static + Send + Sync> PlayerStack<S> {
|
|||
.pl_1()
|
||||
.rounded_lg()
|
||||
.bg(if followers.is_none() {
|
||||
color.transparent
|
||||
theme.transparent
|
||||
} else {
|
||||
player.selection_color(cx)
|
||||
})
|
||||
|
|
|
@ -20,7 +20,7 @@ impl<S: 'static + Send + Sync> ProjectPanel<S> {
|
|||
}
|
||||
|
||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
|
||||
div()
|
||||
.id(self.id.clone())
|
||||
|
@ -28,7 +28,7 @@ impl<S: 'static + Send + Sync> ProjectPanel<S> {
|
|||
.flex_col()
|
||||
.w_full()
|
||||
.h_full()
|
||||
.bg(color.surface)
|
||||
.bg(theme.surface)
|
||||
.child(
|
||||
div()
|
||||
.id("project-panel-contents")
|
||||
|
|
|
@ -87,7 +87,7 @@ impl StatusBar {
|
|||
view: &mut Workspace,
|
||||
cx: &mut ViewContext<Workspace>,
|
||||
) -> impl Element<ViewState = Workspace> {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
|
||||
div()
|
||||
.py_0p5()
|
||||
|
@ -96,7 +96,7 @@ impl StatusBar {
|
|||
.items_center()
|
||||
.justify_between()
|
||||
.w_full()
|
||||
.bg(color.status_bar)
|
||||
.bg(theme.status_bar)
|
||||
.child(self.left_tools(view, cx))
|
||||
.child(self.right_tools(view, cx))
|
||||
}
|
||||
|
@ -106,8 +106,6 @@ impl StatusBar {
|
|||
workspace: &mut Workspace,
|
||||
cx: &WindowContext,
|
||||
) -> impl Element<ViewState = Workspace> {
|
||||
let color = ThemeColor::new(cx);
|
||||
|
||||
div()
|
||||
.flex()
|
||||
.items_center()
|
||||
|
@ -139,8 +137,6 @@ impl StatusBar {
|
|||
workspace: &mut Workspace,
|
||||
cx: &WindowContext,
|
||||
) -> impl Element<ViewState = Workspace> {
|
||||
let color = ThemeColor::new(cx);
|
||||
|
||||
div()
|
||||
.flex()
|
||||
.items_center()
|
||||
|
|
|
@ -82,7 +82,7 @@ impl<S: 'static + Send + Sync + Clone> Tab<S> {
|
|||
}
|
||||
|
||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
let has_fs_conflict = self.fs_status == FileSystemStatus::Conflict;
|
||||
let is_deleted = self.fs_status == FileSystemStatus::Deleted;
|
||||
|
||||
|
@ -105,14 +105,14 @@ impl<S: 'static + Send + Sync + Clone> Tab<S> {
|
|||
|
||||
let (tab_bg, tab_hover_bg, tab_active_bg) = match self.current {
|
||||
true => (
|
||||
color.ghost_element,
|
||||
color.ghost_element_hover,
|
||||
color.ghost_element_active,
|
||||
theme.ghost_element,
|
||||
theme.ghost_element_hover,
|
||||
theme.ghost_element_active,
|
||||
),
|
||||
false => (
|
||||
color.filled_element,
|
||||
color.filled_element_hover,
|
||||
color.filled_element_active,
|
||||
theme.filled_element,
|
||||
theme.filled_element_hover,
|
||||
theme.filled_element_active,
|
||||
),
|
||||
};
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ impl<S: 'static + Send + Sync + Clone> TabBar<S> {
|
|||
}
|
||||
|
||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
|
||||
let (can_navigate_back, can_navigate_forward) = self.can_navigate;
|
||||
|
||||
|
@ -36,7 +36,7 @@ impl<S: 'static + Send + Sync + Clone> TabBar<S> {
|
|||
.id(self.id.clone())
|
||||
.w_full()
|
||||
.flex()
|
||||
.bg(color.tab_bar)
|
||||
.bg(theme.tab_bar)
|
||||
// Left Side
|
||||
.child(
|
||||
div()
|
||||
|
|
|
@ -18,7 +18,7 @@ impl<S: 'static + Send + Sync + Clone> Terminal<S> {
|
|||
}
|
||||
|
||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
|
||||
let can_navigate_back = true;
|
||||
let can_navigate_forward = false;
|
||||
|
@ -32,7 +32,7 @@ impl<S: 'static + Send + Sync + Clone> Terminal<S> {
|
|||
div()
|
||||
.w_full()
|
||||
.flex()
|
||||
.bg(color.surface)
|
||||
.bg(theme.surface)
|
||||
.child(
|
||||
div().px_1().flex().flex_none().gap_2().child(
|
||||
div()
|
||||
|
@ -79,7 +79,7 @@ impl<S: 'static + Send + Sync + Clone> Terminal<S> {
|
|||
height: rems(36.).into(),
|
||||
},
|
||||
)
|
||||
.child(crate::static_data::terminal_buffer(&color)),
|
||||
.child(crate::static_data::terminal_buffer(&theme)),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ impl TitleBar {
|
|||
}
|
||||
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element<ViewState = Self> {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
let settings = user_settings(cx);
|
||||
|
||||
// let has_focus = cx.window_is_active();
|
||||
|
@ -105,7 +105,7 @@ impl TitleBar {
|
|||
.items_center()
|
||||
.justify_between()
|
||||
.w_full()
|
||||
.bg(color.background)
|
||||
.bg(theme.background)
|
||||
.py_1()
|
||||
.child(
|
||||
div()
|
||||
|
|
|
@ -37,7 +37,7 @@ impl<S: 'static + Send + Sync> Toast<S> {
|
|||
}
|
||||
|
||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
|
||||
let mut div = div();
|
||||
|
||||
|
@ -56,7 +56,7 @@ impl<S: 'static + Send + Sync> Toast<S> {
|
|||
.rounded_lg()
|
||||
.shadow_md()
|
||||
.overflow_hidden()
|
||||
.bg(color.elevated_surface)
|
||||
.bg(theme.elevated_surface)
|
||||
.children(self.children.drain(..))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,10 +55,10 @@ impl<S: 'static + Send + Sync> Toolbar<S> {
|
|||
}
|
||||
|
||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
|
||||
div()
|
||||
.bg(color.toolbar)
|
||||
.bg(theme.toolbar)
|
||||
.p_2()
|
||||
.flex()
|
||||
.justify_between()
|
||||
|
@ -97,7 +97,7 @@ mod stories {
|
|||
_view: &mut S,
|
||||
cx: &mut ViewContext<S>,
|
||||
) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
|
||||
Story::container(cx)
|
||||
.child(Story::title_for::<_, Toolbar<S>>(cx))
|
||||
|
@ -110,21 +110,21 @@ mod stories {
|
|||
Symbol(vec![
|
||||
HighlightedText {
|
||||
text: "impl ".to_string(),
|
||||
color: color.syntax.keyword,
|
||||
color: theme.syntax.keyword,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "ToolbarStory".to_string(),
|
||||
color: color.syntax.function,
|
||||
color: theme.syntax.function,
|
||||
},
|
||||
]),
|
||||
Symbol(vec![
|
||||
HighlightedText {
|
||||
text: "fn ".to_string(),
|
||||
color: color.syntax.keyword,
|
||||
color: theme.syntax.keyword,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "render".to_string(),
|
||||
color: color.syntax.function,
|
||||
color: theme.syntax.function,
|
||||
},
|
||||
]),
|
||||
],
|
||||
|
|
|
@ -26,13 +26,13 @@ impl<S: 'static + Send + Sync> TrafficLight<S> {
|
|||
}
|
||||
|
||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
|
||||
let fill = match (self.window_has_focus, self.color) {
|
||||
(true, TrafficLightColor::Red) => color.mac_os_traffic_light_red,
|
||||
(true, TrafficLightColor::Yellow) => color.mac_os_traffic_light_yellow,
|
||||
(true, TrafficLightColor::Green) => color.mac_os_traffic_light_green,
|
||||
(false, _) => color.filled_element,
|
||||
(true, TrafficLightColor::Red) => theme.mac_os_traffic_light_red,
|
||||
(true, TrafficLightColor::Yellow) => theme.mac_os_traffic_light_yellow,
|
||||
(true, TrafficLightColor::Green) => theme.mac_os_traffic_light_green,
|
||||
(false, _) => theme.filled_element,
|
||||
};
|
||||
|
||||
div().w_3().h_3().rounded_full().bg(fill)
|
||||
|
@ -59,8 +59,6 @@ impl<S: 'static + Send + Sync> TrafficLights<S> {
|
|||
}
|
||||
|
||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
|
||||
div()
|
||||
.flex()
|
||||
.items_center()
|
||||
|
|
|
@ -177,8 +177,6 @@ impl Workspace {
|
|||
pub fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element<ViewState = Self> {
|
||||
let theme = old_theme(cx).clone();
|
||||
|
||||
let color = ThemeColor::new(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.
|
||||
// Need to talk with Nathan/Antonio about this.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue