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
|
@ -1,6 +1,5 @@
|
|||
use crate::theme;
|
||||
pub use crate::{old_theme, ButtonVariant, ElementExt, Theme};
|
||||
use gpui2::{hsla, rgb, Hsla, WindowContext};
|
||||
use gpui2::{rgb, Hsla, WindowContext};
|
||||
use strum::EnumIter;
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
|
@ -251,75 +250,6 @@ impl std::fmt::Debug for ThemeColor {
|
|||
}
|
||||
}
|
||||
|
||||
impl ThemeColor {
|
||||
pub fn new(cx: &WindowContext) -> Self {
|
||||
let theme2 = theme(cx);
|
||||
let transparent = hsla(0.0, 0.0, 0.0, 0.0);
|
||||
|
||||
let players = [
|
||||
PlayerThemeColors::new(cx, 0),
|
||||
PlayerThemeColors::new(cx, 1),
|
||||
PlayerThemeColors::new(cx, 2),
|
||||
PlayerThemeColors::new(cx, 3),
|
||||
PlayerThemeColors::new(cx, 4),
|
||||
PlayerThemeColors::new(cx, 5),
|
||||
PlayerThemeColors::new(cx, 6),
|
||||
PlayerThemeColors::new(cx, 7),
|
||||
];
|
||||
|
||||
Self {
|
||||
transparent: theme2.transparent,
|
||||
mac_os_traffic_light_red: theme2.mac_os_traffic_light_red,
|
||||
mac_os_traffic_light_yellow: theme2.mac_os_traffic_light_yellow,
|
||||
mac_os_traffic_light_green: theme2.mac_os_traffic_light_green,
|
||||
border: theme2.border,
|
||||
border_variant: theme2.border_variant,
|
||||
border_focused: theme2.border_focused,
|
||||
border_transparent: theme2.border_transparent,
|
||||
elevated_surface: theme2.elevated_surface,
|
||||
surface: theme2.surface,
|
||||
background: theme2.background,
|
||||
filled_element: theme2.filled_element,
|
||||
filled_element_hover: theme2.filled_element_hover,
|
||||
filled_element_active: theme2.filled_element_active,
|
||||
filled_element_selected: theme2.filled_element_selected,
|
||||
filled_element_disabled: theme2.filled_element_disabled,
|
||||
ghost_element: theme2.ghost_element,
|
||||
ghost_element_hover: theme2.ghost_element_hover,
|
||||
ghost_element_active: theme2.ghost_element_active,
|
||||
ghost_element_selected: theme2.ghost_element_selected,
|
||||
ghost_element_disabled: theme2.ghost_element_disabled,
|
||||
text: theme2.text,
|
||||
text_muted: theme2.text_muted,
|
||||
/// TODO: map this to a real value
|
||||
text_placeholder: theme2.text_placeholder,
|
||||
text_disabled: theme2.text_disabled,
|
||||
text_accent: theme2.text_accent,
|
||||
icon_muted: theme2.icon_muted,
|
||||
syntax: SyntaxColor::new(cx),
|
||||
|
||||
status_bar: theme2.status_bar,
|
||||
title_bar: theme2.title_bar,
|
||||
toolbar: theme2.toolbar,
|
||||
tab_bar: theme2.tab_bar,
|
||||
editor: theme2.editor,
|
||||
editor_subheader: theme2.editor_subheader,
|
||||
terminal: theme2.terminal,
|
||||
editor_active_line: theme2.editor_active_line,
|
||||
image_fallback_background: theme2.image_fallback_background,
|
||||
|
||||
git_created: theme2.git_created,
|
||||
git_modified: theme2.git_modified,
|
||||
git_deleted: theme2.git_deleted,
|
||||
git_conflict: theme2.git_conflict,
|
||||
git_ignored: theme2.git_ignored,
|
||||
git_renamed: theme2.git_renamed,
|
||||
|
||||
player: players,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Colors used exclusively for syntax highlighting.
|
||||
///
|
||||
/// For now we deserialize these from a theme.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -26,7 +26,7 @@ impl<S: 'static + Send + Sync> Avatar<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 img = img();
|
||||
|
||||
|
@ -38,7 +38,7 @@ impl<S: 'static + Send + Sync> Avatar<S> {
|
|||
|
||||
img.uri(self.src.clone())
|
||||
.size_4()
|
||||
.bg(color.image_fallback_background)
|
||||
.bg(theme.image_fallback_background)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ use std::sync::Arc;
|
|||
|
||||
use gpui2::{div, DefiniteLength, Hsla, MouseButton, WindowContext};
|
||||
|
||||
use crate::settings::user_settings;
|
||||
use crate::{h_stack, Icon, IconColor, IconElement, Label, LabelColor};
|
||||
use crate::{prelude::*, LineHeightStyle};
|
||||
|
||||
|
@ -23,29 +22,29 @@ pub enum ButtonVariant {
|
|||
|
||||
impl ButtonVariant {
|
||||
pub fn bg_color(&self, cx: &mut WindowContext) -> Hsla {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
|
||||
match self {
|
||||
ButtonVariant::Ghost => color.ghost_element,
|
||||
ButtonVariant::Filled => color.filled_element,
|
||||
ButtonVariant::Ghost => theme.ghost_element,
|
||||
ButtonVariant::Filled => theme.filled_element,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn bg_color_hover(&self, cx: &mut WindowContext) -> Hsla {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
|
||||
match self {
|
||||
ButtonVariant::Ghost => color.ghost_element_hover,
|
||||
ButtonVariant::Filled => color.filled_element_hover,
|
||||
ButtonVariant::Ghost => theme.ghost_element_hover,
|
||||
ButtonVariant::Filled => theme.filled_element_hover,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn bg_color_active(&self, cx: &mut WindowContext) -> Hsla {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
|
||||
match self {
|
||||
ButtonVariant::Ghost => color.ghost_element_active,
|
||||
ButtonVariant::Filled => color.filled_element_active,
|
||||
ButtonVariant::Ghost => theme.ghost_element_active,
|
||||
ButtonVariant::Filled => theme.filled_element_active,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -156,8 +155,6 @@ impl<S: 'static + Send + Sync> Button<S> {
|
|||
_view: &mut S,
|
||||
cx: &mut ViewContext<S>,
|
||||
) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
let settings = user_settings(cx);
|
||||
let icon_color = self.icon_color();
|
||||
|
||||
let mut button = h_stack()
|
||||
|
|
|
@ -31,13 +31,13 @@ impl<S: 'static + Send + Sync> Details<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()
|
||||
.p_1()
|
||||
.gap_0p5()
|
||||
.text_xs()
|
||||
.text_color(color.text)
|
||||
.text_color(theme.text)
|
||||
.size_full()
|
||||
.child(self.text)
|
||||
.children(self.meta.map(|m| m))
|
||||
|
|
|
@ -177,7 +177,6 @@ impl<S: 'static + Send + Sync> IconElement<S> {
|
|||
}
|
||||
|
||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
let fill = self.color.color(cx);
|
||||
let svg_size = match self.size {
|
||||
IconSize::Small => ui_size(cx, 12. / 14.),
|
||||
|
|
|
@ -61,18 +61,18 @@ impl<S: 'static + Send + Sync> Input<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 (input_bg, input_hover_bg, input_active_bg) = match self.variant {
|
||||
InputVariant::Ghost => (
|
||||
color.ghost_element,
|
||||
color.ghost_element_hover,
|
||||
color.ghost_element_active,
|
||||
theme.ghost_element,
|
||||
theme.ghost_element_hover,
|
||||
theme.ghost_element_active,
|
||||
),
|
||||
InputVariant::Filled => (
|
||||
color.filled_element,
|
||||
color.filled_element_hover,
|
||||
color.filled_element_active,
|
||||
theme.filled_element,
|
||||
theme.filled_element_hover,
|
||||
theme.filled_element_active,
|
||||
),
|
||||
};
|
||||
|
||||
|
@ -94,7 +94,7 @@ impl<S: 'static + Send + Sync> Input<S> {
|
|||
.w_full()
|
||||
.px_2()
|
||||
.border()
|
||||
.border_color(color.transparent)
|
||||
.border_color(theme.transparent)
|
||||
.bg(input_bg)
|
||||
.hover(|style| style.bg(input_hover_bg))
|
||||
.active(|style| style.bg(input_active_bg))
|
||||
|
|
|
@ -22,20 +22,20 @@ pub enum LabelColor {
|
|||
|
||||
impl LabelColor {
|
||||
pub fn hsla(&self, cx: &WindowContext) -> Hsla {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
// TODO: Remove
|
||||
let theme = old_theme(cx);
|
||||
let old_theme = old_theme(cx);
|
||||
|
||||
match self {
|
||||
Self::Default => color.text,
|
||||
Self::Muted => color.text_muted,
|
||||
Self::Created => theme.middle.positive.default.foreground,
|
||||
Self::Modified => theme.middle.warning.default.foreground,
|
||||
Self::Deleted => theme.middle.negative.default.foreground,
|
||||
Self::Disabled => color.text_disabled,
|
||||
Self::Hidden => theme.middle.variant.default.foreground,
|
||||
Self::Placeholder => color.text_placeholder,
|
||||
Self::Accent => theme.middle.accent.default.foreground,
|
||||
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::Disabled => theme.text_disabled,
|
||||
Self::Hidden => old_theme.middle.variant.default.foreground,
|
||||
Self::Placeholder => theme.text_placeholder,
|
||||
Self::Accent => old_theme.middle.accent.default.foreground,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -84,8 +84,6 @@ impl<S: 'static + Send + Sync> Label<S> {
|
|||
}
|
||||
|
||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
|
||||
div()
|
||||
.when(self.strikethrough, |this| {
|
||||
this.relative().child(
|
||||
|
@ -138,9 +136,9 @@ impl<S: 'static + Send + Sync> HighlightedLabel<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 highlight_color = color.text_accent;
|
||||
let highlight_color = theme.text_accent;
|
||||
|
||||
let mut highlight_indices = self.highlight_indices.iter().copied().peekable();
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use gpui2::{Hsla, ViewContext};
|
||||
|
||||
use crate::ThemeColor;
|
||||
use crate::theme;
|
||||
|
||||
#[derive(Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)]
|
||||
pub enum PlayerStatus {
|
||||
|
@ -139,15 +139,13 @@ impl Player {
|
|||
}
|
||||
|
||||
pub fn cursor_color<S: 'static>(&self, cx: &mut ViewContext<S>) -> Hsla {
|
||||
let color = ThemeColor::new(cx);
|
||||
let index = self.index % 8;
|
||||
color.player[self.index].cursor
|
||||
let theme = theme(cx);
|
||||
theme.player[self.index].cursor
|
||||
}
|
||||
|
||||
pub fn selection_color<S: 'static>(&self, cx: &mut ViewContext<S>) -> Hsla {
|
||||
let color = ThemeColor::new(cx);
|
||||
let index = self.index % 8;
|
||||
color.player[self.index].selection
|
||||
let theme = theme(cx);
|
||||
theme.player[self.index].selection
|
||||
}
|
||||
|
||||
pub fn avatar_src(&self) -> &str {
|
||||
|
|
|
@ -15,8 +15,8 @@ impl<S: 'static + Send + Sync> ToolDivider<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().w_px().h_3().bg(color.border)
|
||||
div().w_px().h_3().bg(theme.border)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ pub use gpui2::{
|
|||
pub use crate::color::*;
|
||||
pub use crate::elevation::*;
|
||||
use crate::settings::user_settings;
|
||||
pub use crate::{old_theme, ButtonVariant, ElementExt, Theme};
|
||||
pub use crate::{old_theme, theme, ButtonVariant, ElementExt, Theme};
|
||||
|
||||
use gpui2::{rems, Hsla, Rems};
|
||||
use strum::EnumIter;
|
||||
|
@ -61,15 +61,15 @@ impl GitStatus {
|
|||
}
|
||||
|
||||
pub fn hsla(&self, cx: &WindowContext) -> Hsla {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
|
||||
match self {
|
||||
Self::None => color.transparent,
|
||||
Self::Created => color.git_created,
|
||||
Self::Modified => color.git_modified,
|
||||
Self::Deleted => color.git_deleted,
|
||||
Self::Conflict => color.git_conflict,
|
||||
Self::Renamed => color.git_renamed,
|
||||
Self::None => theme.transparent,
|
||||
Self::Created => theme.git_created,
|
||||
Self::Modified => theme.git_modified,
|
||||
Self::Deleted => theme.git_deleted,
|
||||
Self::Conflict => theme.git_conflict,
|
||||
Self::Renamed => theme.git_renamed,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,12 +3,13 @@ use std::str::FromStr;
|
|||
|
||||
use gpui2::WindowContext;
|
||||
use rand::Rng;
|
||||
use theme2::Theme;
|
||||
|
||||
use crate::{
|
||||
Buffer, BufferRow, BufferRows, Button, EditorPane, FileSystemStatus, GitStatus,
|
||||
theme, Buffer, BufferRow, BufferRows, Button, EditorPane, FileSystemStatus, GitStatus,
|
||||
HighlightedLine, Icon, Keybinding, Label, LabelColor, ListEntry, ListEntrySize, ListItem,
|
||||
Livestream, MicStatus, ModifierKeys, PaletteItem, Player, PlayerCallStatus,
|
||||
PlayerWithCallStatus, ScreenShareStatus, Symbol, Tab, ThemeColor, ToggleState, VideoStatus,
|
||||
PlayerWithCallStatus, ScreenShareStatus, Symbol, Tab, ToggleState, VideoStatus,
|
||||
};
|
||||
use crate::{HighlightedText, ListDetailsEntry};
|
||||
|
||||
|
@ -642,7 +643,7 @@ pub fn empty_buffer_example<S: 'static + Send + Sync + Clone>() -> Buffer<S> {
|
|||
}
|
||||
|
||||
pub fn hello_world_rust_editor_example(cx: &mut WindowContext) -> EditorPane {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
|
||||
EditorPane::new(
|
||||
cx,
|
||||
|
@ -651,19 +652,19 @@ pub fn hello_world_rust_editor_example(cx: &mut WindowContext) -> EditorPane {
|
|||
vec![Symbol(vec![
|
||||
HighlightedText {
|
||||
text: "fn ".to_string(),
|
||||
color: color.syntax.keyword,
|
||||
color: theme.syntax.keyword,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "main".to_string(),
|
||||
color: color.syntax.function,
|
||||
color: theme.syntax.function,
|
||||
},
|
||||
])],
|
||||
hello_world_rust_buffer_example(&color),
|
||||
hello_world_rust_buffer_example(&theme),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn hello_world_rust_buffer_example<S: 'static + Send + Sync + Clone>(
|
||||
color: &ThemeColor,
|
||||
theme: &Theme,
|
||||
) -> Buffer<S> {
|
||||
Buffer::new("hello-world-rust-buffer")
|
||||
.set_title("hello_world.rs".to_string())
|
||||
|
@ -671,11 +672,11 @@ pub fn hello_world_rust_buffer_example<S: 'static + Send + Sync + Clone>(
|
|||
.set_language("rust".to_string())
|
||||
.set_rows(Some(BufferRows {
|
||||
show_line_numbers: true,
|
||||
rows: hello_world_rust_buffer_rows(color),
|
||||
rows: hello_world_rust_buffer_rows(theme),
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn hello_world_rust_buffer_rows(color: &ThemeColor) -> Vec<BufferRow> {
|
||||
pub fn hello_world_rust_buffer_rows(theme: &Theme) -> Vec<BufferRow> {
|
||||
let show_line_number = true;
|
||||
|
||||
vec![
|
||||
|
@ -687,15 +688,15 @@ pub fn hello_world_rust_buffer_rows(color: &ThemeColor) -> Vec<BufferRow> {
|
|||
highlighted_texts: vec![
|
||||
HighlightedText {
|
||||
text: "fn ".to_string(),
|
||||
color: color.syntax.keyword,
|
||||
color: theme.syntax.keyword,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "main".to_string(),
|
||||
color: color.syntax.function,
|
||||
color: theme.syntax.function,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "() {".to_string(),
|
||||
color: color.text,
|
||||
color: theme.text,
|
||||
},
|
||||
],
|
||||
}),
|
||||
|
@ -711,7 +712,7 @@ pub fn hello_world_rust_buffer_rows(color: &ThemeColor) -> Vec<BufferRow> {
|
|||
highlighted_texts: vec![HighlightedText {
|
||||
text: " // Statements here are executed when the compiled binary is called."
|
||||
.to_string(),
|
||||
color: color.syntax.comment,
|
||||
color: theme.syntax.comment,
|
||||
}],
|
||||
}),
|
||||
cursors: None,
|
||||
|
@ -734,7 +735,7 @@ pub fn hello_world_rust_buffer_rows(color: &ThemeColor) -> Vec<BufferRow> {
|
|||
line: Some(HighlightedLine {
|
||||
highlighted_texts: vec![HighlightedText {
|
||||
text: " // Print text to the console.".to_string(),
|
||||
color: color.syntax.comment,
|
||||
color: theme.syntax.comment,
|
||||
}],
|
||||
}),
|
||||
cursors: None,
|
||||
|
@ -749,15 +750,15 @@ pub fn hello_world_rust_buffer_rows(color: &ThemeColor) -> Vec<BufferRow> {
|
|||
highlighted_texts: vec![
|
||||
HighlightedText {
|
||||
text: " println!(".to_string(),
|
||||
color: color.text,
|
||||
color: theme.text,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "\"Hello, world!\"".to_string(),
|
||||
color: color.syntax.string,
|
||||
color: theme.syntax.string,
|
||||
},
|
||||
HighlightedText {
|
||||
text: ");".to_string(),
|
||||
color: color.text,
|
||||
color: theme.text,
|
||||
},
|
||||
],
|
||||
}),
|
||||
|
@ -772,7 +773,7 @@ pub fn hello_world_rust_buffer_rows(color: &ThemeColor) -> Vec<BufferRow> {
|
|||
line: Some(HighlightedLine {
|
||||
highlighted_texts: vec![HighlightedText {
|
||||
text: "}".to_string(),
|
||||
color: color.text,
|
||||
color: theme.text,
|
||||
}],
|
||||
}),
|
||||
cursors: None,
|
||||
|
@ -783,7 +784,7 @@ pub fn hello_world_rust_buffer_rows(color: &ThemeColor) -> Vec<BufferRow> {
|
|||
}
|
||||
|
||||
pub fn hello_world_rust_editor_with_status_example(cx: &mut WindowContext) -> EditorPane {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
|
||||
EditorPane::new(
|
||||
cx,
|
||||
|
@ -792,19 +793,19 @@ pub fn hello_world_rust_editor_with_status_example(cx: &mut WindowContext) -> Ed
|
|||
vec![Symbol(vec![
|
||||
HighlightedText {
|
||||
text: "fn ".to_string(),
|
||||
color: color.syntax.keyword,
|
||||
color: theme.syntax.keyword,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "main".to_string(),
|
||||
color: color.syntax.function,
|
||||
color: theme.syntax.function,
|
||||
},
|
||||
])],
|
||||
hello_world_rust_buffer_with_status_example(&color),
|
||||
hello_world_rust_buffer_with_status_example(&theme),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn hello_world_rust_buffer_with_status_example<S: 'static + Send + Sync + Clone>(
|
||||
color: &ThemeColor,
|
||||
theme: &Theme,
|
||||
) -> Buffer<S> {
|
||||
Buffer::new("hello-world-rust-buffer-with-status")
|
||||
.set_title("hello_world.rs".to_string())
|
||||
|
@ -812,11 +813,11 @@ pub fn hello_world_rust_buffer_with_status_example<S: 'static + Send + Sync + Cl
|
|||
.set_language("rust".to_string())
|
||||
.set_rows(Some(BufferRows {
|
||||
show_line_numbers: true,
|
||||
rows: hello_world_rust_with_status_buffer_rows(color),
|
||||
rows: hello_world_rust_with_status_buffer_rows(theme),
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn hello_world_rust_with_status_buffer_rows(color: &ThemeColor) -> Vec<BufferRow> {
|
||||
pub fn hello_world_rust_with_status_buffer_rows(theme: &Theme) -> Vec<BufferRow> {
|
||||
let show_line_number = true;
|
||||
|
||||
vec![
|
||||
|
@ -828,15 +829,15 @@ pub fn hello_world_rust_with_status_buffer_rows(color: &ThemeColor) -> Vec<Buffe
|
|||
highlighted_texts: vec![
|
||||
HighlightedText {
|
||||
text: "fn ".to_string(),
|
||||
color: color.syntax.keyword,
|
||||
color: theme.syntax.keyword,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "main".to_string(),
|
||||
color: color.syntax.function,
|
||||
color: theme.syntax.function,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "() {".to_string(),
|
||||
color: color.text,
|
||||
color: theme.text,
|
||||
},
|
||||
],
|
||||
}),
|
||||
|
@ -852,7 +853,7 @@ pub fn hello_world_rust_with_status_buffer_rows(color: &ThemeColor) -> Vec<Buffe
|
|||
highlighted_texts: vec![HighlightedText {
|
||||
text: "// Statements here are executed when the compiled binary is called."
|
||||
.to_string(),
|
||||
color: color.syntax.comment,
|
||||
color: theme.syntax.comment,
|
||||
}],
|
||||
}),
|
||||
cursors: None,
|
||||
|
@ -875,7 +876,7 @@ pub fn hello_world_rust_with_status_buffer_rows(color: &ThemeColor) -> Vec<Buffe
|
|||
line: Some(HighlightedLine {
|
||||
highlighted_texts: vec![HighlightedText {
|
||||
text: " // Print text to the console.".to_string(),
|
||||
color: color.syntax.comment,
|
||||
color: theme.syntax.comment,
|
||||
}],
|
||||
}),
|
||||
cursors: None,
|
||||
|
@ -890,15 +891,15 @@ pub fn hello_world_rust_with_status_buffer_rows(color: &ThemeColor) -> Vec<Buffe
|
|||
highlighted_texts: vec![
|
||||
HighlightedText {
|
||||
text: " println!(".to_string(),
|
||||
color: color.text,
|
||||
color: theme.text,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "\"Hello, world!\"".to_string(),
|
||||
color: color.syntax.string,
|
||||
color: theme.syntax.string,
|
||||
},
|
||||
HighlightedText {
|
||||
text: ");".to_string(),
|
||||
color: color.text,
|
||||
color: theme.text,
|
||||
},
|
||||
],
|
||||
}),
|
||||
|
@ -913,7 +914,7 @@ pub fn hello_world_rust_with_status_buffer_rows(color: &ThemeColor) -> Vec<Buffe
|
|||
line: Some(HighlightedLine {
|
||||
highlighted_texts: vec![HighlightedText {
|
||||
text: "}".to_string(),
|
||||
color: color.text,
|
||||
color: theme.text,
|
||||
}],
|
||||
}),
|
||||
cursors: None,
|
||||
|
@ -927,7 +928,7 @@ pub fn hello_world_rust_with_status_buffer_rows(color: &ThemeColor) -> Vec<Buffe
|
|||
line: Some(HighlightedLine {
|
||||
highlighted_texts: vec![HighlightedText {
|
||||
text: "".to_string(),
|
||||
color: color.text,
|
||||
color: theme.text,
|
||||
}],
|
||||
}),
|
||||
cursors: None,
|
||||
|
@ -941,7 +942,7 @@ pub fn hello_world_rust_with_status_buffer_rows(color: &ThemeColor) -> Vec<Buffe
|
|||
line: Some(HighlightedLine {
|
||||
highlighted_texts: vec![HighlightedText {
|
||||
text: "// Marshall and Nate were here".to_string(),
|
||||
color: color.syntax.comment,
|
||||
color: theme.syntax.comment,
|
||||
}],
|
||||
}),
|
||||
cursors: None,
|
||||
|
@ -951,16 +952,16 @@ pub fn hello_world_rust_with_status_buffer_rows(color: &ThemeColor) -> Vec<Buffe
|
|||
]
|
||||
}
|
||||
|
||||
pub fn terminal_buffer<S: 'static + Send + Sync + Clone>(color: &ThemeColor) -> Buffer<S> {
|
||||
pub fn terminal_buffer<S: 'static + Send + Sync + Clone>(theme: &Theme) -> Buffer<S> {
|
||||
Buffer::new("terminal")
|
||||
.set_title("zed — fish".to_string())
|
||||
.set_rows(Some(BufferRows {
|
||||
show_line_numbers: false,
|
||||
rows: terminal_buffer_rows(color),
|
||||
rows: terminal_buffer_rows(theme),
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn terminal_buffer_rows(color: &ThemeColor) -> Vec<BufferRow> {
|
||||
pub fn terminal_buffer_rows(theme: &Theme) -> Vec<BufferRow> {
|
||||
let show_line_number = false;
|
||||
|
||||
vec![
|
||||
|
@ -972,31 +973,31 @@ pub fn terminal_buffer_rows(color: &ThemeColor) -> Vec<BufferRow> {
|
|||
highlighted_texts: vec![
|
||||
HighlightedText {
|
||||
text: "maxdeviant ".to_string(),
|
||||
color: color.syntax.keyword,
|
||||
color: theme.syntax.keyword,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "in ".to_string(),
|
||||
color: color.text,
|
||||
color: theme.text,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "profaned-capital ".to_string(),
|
||||
color: color.syntax.function,
|
||||
color: theme.syntax.function,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "in ".to_string(),
|
||||
color: color.text,
|
||||
color: theme.text,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "~/p/zed ".to_string(),
|
||||
color: color.syntax.function,
|
||||
color: theme.syntax.function,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "on ".to_string(),
|
||||
color: color.text,
|
||||
color: theme.text,
|
||||
},
|
||||
HighlightedText {
|
||||
text: " gpui2-ui ".to_string(),
|
||||
color: color.syntax.keyword,
|
||||
color: theme.syntax.keyword,
|
||||
},
|
||||
],
|
||||
}),
|
||||
|
@ -1011,7 +1012,7 @@ pub fn terminal_buffer_rows(color: &ThemeColor) -> Vec<BufferRow> {
|
|||
line: Some(HighlightedLine {
|
||||
highlighted_texts: vec![HighlightedText {
|
||||
text: "λ ".to_string(),
|
||||
color: color.syntax.string,
|
||||
color: theme.syntax.string,
|
||||
}],
|
||||
}),
|
||||
cursors: None,
|
||||
|
|
|
@ -6,7 +6,7 @@ pub struct Story {}
|
|||
|
||||
impl Story {
|
||||
pub fn container<S: 'static + Send + Sync>(cx: &mut ViewContext<S>) -> Div<S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
|
||||
div()
|
||||
.size_full()
|
||||
|
@ -15,18 +15,18 @@ impl Story {
|
|||
.pt_2()
|
||||
.px_4()
|
||||
.font("Zed Mono")
|
||||
.bg(color.background)
|
||||
.bg(theme.background)
|
||||
}
|
||||
|
||||
pub fn title<S: 'static + Send + Sync>(
|
||||
cx: &mut ViewContext<S>,
|
||||
title: &str,
|
||||
) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
|
||||
div()
|
||||
.text_xl()
|
||||
.text_color(color.text)
|
||||
.text_color(theme.text)
|
||||
.child(title.to_owned())
|
||||
}
|
||||
|
||||
|
@ -40,13 +40,13 @@ impl Story {
|
|||
cx: &mut ViewContext<S>,
|
||||
label: &str,
|
||||
) -> impl Element<ViewState = S> {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
|
||||
div()
|
||||
.mt_4()
|
||||
.mb_2()
|
||||
.text_xs()
|
||||
.text_color(color.text)
|
||||
.text_color(theme.text)
|
||||
.child(label.to_owned())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue