Checkpoint – Broken
This commit is contained in:
parent
b16d37953d
commit
bca97f7186
33 changed files with 183 additions and 127 deletions
|
@ -27,7 +27,7 @@ impl<S: 'static + Send + Sync + Clone> AssistantPanel<S> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
fn render(&mut self, view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
Panel::new(self.scroll_state.clone())
|
Panel::new(self.scroll_state.clone())
|
||||||
.children(vec![div()
|
.children(vec![div()
|
||||||
|
|
|
@ -25,10 +25,9 @@ impl<S: 'static + Send + Sync + Clone> Breadcrumb<S> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_separator(&self, theme: &Theme) -> Div<S> {
|
fn render_separator(&self, cx: &WindowContext) -> Div<S> {
|
||||||
div()
|
let color = ThemeColor::new(cx);
|
||||||
.child(" › ")
|
div().child(" › ").text_color(color.text_muted)
|
||||||
.text_color(HighlightColor::Default.hsla(theme))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(
|
fn render(
|
||||||
|
@ -36,21 +35,22 @@ impl<S: 'static + Send + Sync + Clone> Breadcrumb<S> {
|
||||||
view_state: &mut S,
|
view_state: &mut S,
|
||||||
cx: &mut ViewContext<S>,
|
cx: &mut ViewContext<S>,
|
||||||
) -> impl Element<ViewState = S> {
|
) -> impl Element<ViewState = S> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
let symbols_len = self.symbols.len();
|
let symbols_len = self.symbols.len();
|
||||||
|
|
||||||
h_stack()
|
h_stack()
|
||||||
.px_1()
|
.px_1()
|
||||||
// TODO: Read font from theme (or settings?).
|
|
||||||
.font("Zed Mono Extended")
|
|
||||||
.text_sm()
|
.text_sm()
|
||||||
.text_color(theme.middle.base.default.foreground)
|
.text_color(color.text_muted)
|
||||||
.rounded_md()
|
.rounded_md()
|
||||||
.hover(|style| style.bg(theme.highest.base.hovered.background))
|
.hover(|style| style.bg(color.ghost_element_hover))
|
||||||
|
// TODO: Add this when active is ready
|
||||||
|
// .active(|style| style.bg(color.ghost_element_active))
|
||||||
.child(self.path.clone().to_str().unwrap().to_string())
|
.child(self.path.clone().to_str().unwrap().to_string())
|
||||||
.child(if !self.symbols.is_empty() {
|
.child(if !self.symbols.is_empty() {
|
||||||
self.render_separator(&theme)
|
self.render_separator(cx)
|
||||||
} else {
|
} else {
|
||||||
div()
|
div()
|
||||||
})
|
})
|
||||||
|
@ -68,7 +68,7 @@ impl<S: 'static + Send + Sync + Clone> Breadcrumb<S> {
|
||||||
|
|
||||||
let is_last_segment = ix == symbols_len - 1;
|
let is_last_segment = ix == symbols_len - 1;
|
||||||
if !is_last_segment {
|
if !is_last_segment {
|
||||||
items.push(self.render_separator(&theme));
|
items.push(self.render_separator(cx));
|
||||||
}
|
}
|
||||||
|
|
||||||
items
|
items
|
||||||
|
@ -107,7 +107,7 @@ mod stories {
|
||||||
view_state: &mut S,
|
view_state: &mut S,
|
||||||
cx: &mut ViewContext<S>,
|
cx: &mut ViewContext<S>,
|
||||||
) -> impl Element<ViewState = S> {
|
) -> impl Element<ViewState = S> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
Story::container(cx)
|
Story::container(cx)
|
||||||
.child(Story::title_for::<_, Breadcrumb<S>>(cx))
|
.child(Story::title_for::<_, Breadcrumb<S>>(cx))
|
||||||
|
@ -118,21 +118,21 @@ mod stories {
|
||||||
Symbol(vec![
|
Symbol(vec![
|
||||||
HighlightedText {
|
HighlightedText {
|
||||||
text: "impl ".to_string(),
|
text: "impl ".to_string(),
|
||||||
color: HighlightColor::Keyword.hsla(&theme),
|
color: color.syntax.keyword,
|
||||||
},
|
},
|
||||||
HighlightedText {
|
HighlightedText {
|
||||||
text: "BreadcrumbStory".to_string(),
|
text: "BreadcrumbStory".to_string(),
|
||||||
color: HighlightColor::Function.hsla(&theme),
|
color: color.syntax.function,
|
||||||
},
|
},
|
||||||
]),
|
]),
|
||||||
Symbol(vec![
|
Symbol(vec![
|
||||||
HighlightedText {
|
HighlightedText {
|
||||||
text: "fn ".to_string(),
|
text: "fn ".to_string(),
|
||||||
color: HighlightColor::Keyword.hsla(&theme),
|
color: color.syntax.keyword,
|
||||||
},
|
},
|
||||||
HighlightedText {
|
HighlightedText {
|
||||||
text: "render".to_string(),
|
text: "render".to_string(),
|
||||||
color: HighlightColor::Function.hsla(&theme),
|
color: color.syntax.function,
|
||||||
},
|
},
|
||||||
]),
|
]),
|
||||||
],
|
],
|
||||||
|
|
|
@ -163,19 +163,19 @@ impl<S: 'static + Send + Sync + Clone> Buffer<S> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_row(row: BufferRow, cx: &WindowContext) -> impl Element<ViewState = S> {
|
fn render_row(row: BufferRow, cx: &WindowContext) -> impl Element<ViewState = S> {
|
||||||
let theme = theme(cx);
|
|
||||||
let system_color = SystemColor::new();
|
let system_color = SystemColor::new();
|
||||||
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
let line_background = if row.current {
|
let line_background = if row.current {
|
||||||
theme.middle.base.default.background
|
color.editor_active_line
|
||||||
} else {
|
} else {
|
||||||
system_color.transparent
|
system_color.transparent
|
||||||
};
|
};
|
||||||
|
|
||||||
let line_number_color = if row.current {
|
let line_number_color = if row.current {
|
||||||
HighlightColor::Default.hsla(&theme)
|
color.text
|
||||||
} else {
|
} else {
|
||||||
HighlightColor::Comment.hsla(&theme)
|
color.syntax.comment
|
||||||
};
|
};
|
||||||
|
|
||||||
h_stack()
|
h_stack()
|
||||||
|
@ -225,14 +225,14 @@ impl<S: 'static + Send + Sync + Clone> Buffer<S> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
let rows = self.render_rows(cx);
|
let rows = self.render_rows(cx);
|
||||||
|
|
||||||
v_stack()
|
v_stack()
|
||||||
.flex_1()
|
.flex_1()
|
||||||
.w_full()
|
.w_full()
|
||||||
.h_full()
|
.h_full()
|
||||||
.bg(theme.highest.base.default.background)
|
.bg(color.editor_background)
|
||||||
.children(rows)
|
.children(rows)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -268,7 +268,7 @@ mod stories {
|
||||||
_view: &mut S,
|
_view: &mut S,
|
||||||
cx: &mut ViewContext<S>,
|
cx: &mut ViewContext<S>,
|
||||||
) -> impl Element<ViewState = S> {
|
) -> impl Element<ViewState = S> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
Story::container(cx)
|
Story::container(cx)
|
||||||
.child(Story::title_for::<_, Buffer<S>>(cx))
|
.child(Story::title_for::<_, Buffer<S>>(cx))
|
||||||
|
|
|
@ -21,27 +21,22 @@ impl BufferSearch {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn view(cx: &mut WindowContext) -> View<Self> {
|
pub fn view(cx: &mut WindowContext) -> View<Self> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
view(cx.entity(|cx| Self::new()), Self::render)
|
view(cx.entity(|cx| Self::new()), Self::render)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element<ViewState = Self> {
|
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element<ViewState = Self> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
h_stack()
|
h_stack().bg(color.toolbar_background).p_2().child(
|
||||||
.bg(theme.highest.base.default.background)
|
h_stack().child(Input::new("Search")).child(
|
||||||
.p_2()
|
IconButton::<Self>::new(Icon::Replace)
|
||||||
.child(
|
.when(self.is_replace_open, |this| this.color(IconColor::Accent))
|
||||||
h_stack()
|
.on_click(|buffer_search, cx| {
|
||||||
.child(Input::new("Search (↑/↓ for previous/next query)"))
|
buffer_search.toggle_replace(cx);
|
||||||
.child(
|
}),
|
||||||
IconButton::<Self>::new(Icon::Replace)
|
),
|
||||||
.when(self.is_replace_open, |this| this.color(IconColor::Accent))
|
)
|
||||||
.on_click(|buffer_search, cx| {
|
|
||||||
buffer_search.toggle_replace(cx);
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,8 +26,6 @@ impl<S: 'static + Send + Sync + Clone> ChatPanel<S> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||||
let theme = theme(cx);
|
|
||||||
|
|
||||||
div()
|
div()
|
||||||
.flex()
|
.flex()
|
||||||
.flex_col()
|
.flex_col()
|
||||||
|
|
|
@ -24,7 +24,7 @@ impl<S: 'static + Send + Sync + Clone> CollabPanel<S> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
let color = ThemeColor::new(cx);
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
v_stack()
|
v_stack()
|
||||||
|
@ -35,20 +35,15 @@ impl<S: 'static + Send + Sync + Clone> CollabPanel<S> {
|
||||||
.w_full()
|
.w_full()
|
||||||
.overflow_y_scroll(self.scroll_state.clone())
|
.overflow_y_scroll(self.scroll_state.clone())
|
||||||
.child(
|
.child(
|
||||||
div()
|
div().pb_1().border_color(color.border).border_b().child(
|
||||||
.bg(theme.lowest.base.default.background)
|
List::new(static_collab_panel_current_call())
|
||||||
.pb_1()
|
.header(
|
||||||
.border_color(theme.lowest.base.default.border)
|
ListHeader::new("CRDB")
|
||||||
.border_b()
|
.set_left_icon(Icon::Hash.into())
|
||||||
.child(
|
.set_toggle(ToggleState::Toggled),
|
||||||
List::new(static_collab_panel_current_call())
|
)
|
||||||
.header(
|
.set_toggle(ToggleState::Toggled),
|
||||||
ListHeader::new("CRDB")
|
),
|
||||||
.set_left_icon(Icon::Hash.into())
|
|
||||||
.set_toggle(ToggleState::Toggled),
|
|
||||||
)
|
|
||||||
.set_toggle(ToggleState::Toggled),
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
v_stack().py_1().child(
|
v_stack().py_1().child(
|
||||||
|
@ -86,13 +81,13 @@ impl<S: 'static + Send + Sync + Clone> CollabPanel<S> {
|
||||||
.h_7()
|
.h_7()
|
||||||
.px_2()
|
.px_2()
|
||||||
.border_t()
|
.border_t()
|
||||||
.border_color(theme.middle.variant.default.border)
|
.border_color(color.border)
|
||||||
.flex()
|
.flex()
|
||||||
.items_center()
|
.items_center()
|
||||||
.child(
|
.child(
|
||||||
div()
|
div()
|
||||||
.text_sm()
|
.text_sm()
|
||||||
.text_color(theme.middle.variant.default.foreground)
|
.text_color(color.text_placeholder)
|
||||||
.child("Find..."),
|
.child("Find..."),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
@ -102,8 +97,9 @@ impl<S: 'static + Send + Sync + Clone> CollabPanel<S> {
|
||||||
&self,
|
&self,
|
||||||
label: impl Into<SharedString>,
|
label: impl Into<SharedString>,
|
||||||
expanded: bool,
|
expanded: bool,
|
||||||
theme: &Theme,
|
cx: &WindowContext,
|
||||||
) -> impl Element<ViewState = S> {
|
) -> impl Element<ViewState = S> {
|
||||||
|
let color = ThemeColor::new(cx);
|
||||||
div()
|
div()
|
||||||
.h_7()
|
.h_7()
|
||||||
.px_2()
|
.px_2()
|
||||||
|
@ -121,7 +117,7 @@ impl<S: 'static + Send + Sync + Clone> CollabPanel<S> {
|
||||||
})
|
})
|
||||||
.w_3p5()
|
.w_3p5()
|
||||||
.h_3p5()
|
.h_3p5()
|
||||||
.text_color(theme.middle.variant.default.foreground),
|
.text_color(color.icon_muted),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -130,14 +126,16 @@ impl<S: 'static + Send + Sync + Clone> CollabPanel<S> {
|
||||||
&self,
|
&self,
|
||||||
avatar_uri: impl Into<SharedString>,
|
avatar_uri: impl Into<SharedString>,
|
||||||
label: impl Into<SharedString>,
|
label: impl Into<SharedString>,
|
||||||
theme: &Theme,
|
cx: &WindowContext,
|
||||||
) -> impl Element<ViewState = S> {
|
) -> impl Element<ViewState = S> {
|
||||||
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
div()
|
div()
|
||||||
.h_7()
|
.h_7()
|
||||||
.px_2()
|
.px_2()
|
||||||
.flex()
|
.flex()
|
||||||
.items_center()
|
.items_center()
|
||||||
.hover(|style| style.bg(theme.lowest.variant.hovered.background))
|
.hover(|style| style.bg(color.ghost_element_hover))
|
||||||
// .active(|style| style.fill(theme.lowest.variant.pressed.background))
|
// .active(|style| style.fill(theme.lowest.variant.pressed.background))
|
||||||
.child(
|
.child(
|
||||||
div()
|
div()
|
||||||
|
@ -146,11 +144,11 @@ impl<S: 'static + Send + Sync + Clone> CollabPanel<S> {
|
||||||
.gap_1()
|
.gap_1()
|
||||||
.text_sm()
|
.text_sm()
|
||||||
.child(
|
.child(
|
||||||
img().uri(avatar_uri).size_3p5().rounded_full().bg(theme
|
img()
|
||||||
.middle
|
.uri(avatar_uri)
|
||||||
.positive
|
.size_3p5()
|
||||||
.default
|
.rounded_full()
|
||||||
.foreground),
|
.bg(color.image_fallback_background),
|
||||||
)
|
)
|
||||||
.child(label.into()),
|
.child(label.into()),
|
||||||
)
|
)
|
||||||
|
|
|
@ -44,13 +44,13 @@ impl<S: 'static + Send + Sync + Clone> ContextMenu<S> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
v_stack()
|
v_stack()
|
||||||
.flex()
|
.flex()
|
||||||
.bg(theme.lowest.base.default.background)
|
.bg(color.elevated_surface)
|
||||||
.border()
|
.border()
|
||||||
.border_color(theme.lowest.base.default.border)
|
.border_color(color.border)
|
||||||
.child(
|
.child(
|
||||||
List::new(
|
List::new(
|
||||||
self.items
|
self.items
|
||||||
|
|
|
@ -43,7 +43,7 @@ impl EditorPane {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn view(cx: &mut WindowContext) -> View<Self> {
|
pub fn view(cx: &mut WindowContext) -> View<Self> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
view(
|
view(
|
||||||
cx.entity(|cx| hello_world_rust_editor_with_status_example(cx)),
|
cx.entity(|cx| hello_world_rust_editor_with_status_example(cx)),
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
use crate::{theme, Avatar, Player};
|
use crate::{Avatar, Player};
|
||||||
|
|
||||||
#[derive(Element)]
|
#[derive(Element)]
|
||||||
pub struct Facepile<S: 'static + Send + Sync> {
|
pub struct Facepile<S: 'static + Send + Sync> {
|
||||||
|
@ -18,7 +18,7 @@ impl<S: 'static + Send + Sync> Facepile<S> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
let player_count = self.players.len();
|
let player_count = self.players.len();
|
||||||
let player_list = self.players.iter().enumerate().map(|(ix, player)| {
|
let player_list = self.players.iter().enumerate().map(|(ix, player)| {
|
||||||
let isnt_last = ix < player_count - 1;
|
let isnt_last = ix < player_count - 1;
|
||||||
|
@ -52,7 +52,11 @@ mod stories {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
fn render(
|
||||||
|
&mut self,
|
||||||
|
_view: &mut S,
|
||||||
|
cx: &mut ViewContext<S>,
|
||||||
|
) -> impl Element<ViewState = S> {
|
||||||
let players = static_players();
|
let players = static_players();
|
||||||
|
|
||||||
Story::container(cx)
|
Story::container(cx)
|
||||||
|
|
|
@ -67,7 +67,6 @@ impl<S: 'static + Send + Sync> IconButton<S> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||||
let theme = theme(cx);
|
|
||||||
let color = ThemeColor::new(cx);
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
let icon_color = match (self.state, self.color) {
|
let icon_color = match (self.state, self.color) {
|
||||||
|
@ -75,15 +74,27 @@ impl<S: 'static + Send + Sync> IconButton<S> {
|
||||||
_ => self.color,
|
_ => self.color,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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,
|
||||||
|
),
|
||||||
|
ButtonVariant::Ghost => (
|
||||||
|
color.ghost_element,
|
||||||
|
color.ghost_element_hover,
|
||||||
|
color.ghost_element_active,
|
||||||
|
),
|
||||||
|
};
|
||||||
|
|
||||||
let mut button = h_stack()
|
let mut button = h_stack()
|
||||||
.justify_center()
|
.justify_center()
|
||||||
.rounded_md()
|
.rounded_md()
|
||||||
.py(ui_size(0.25))
|
.py(ui_size(0.25))
|
||||||
.px(ui_size(6. / 14.))
|
.px(ui_size(6. / 14.))
|
||||||
.when(self.variant == ButtonVariant::Filled, |this| {
|
.bg(bg_color)
|
||||||
this.bg(color.filled_element)
|
.hover(|style| style.bg(bg_hover_color))
|
||||||
})
|
// .active(|style| style.bg(bg_active_color))
|
||||||
.hover(|style| style.bg(theme.highest.base.hovered.background))
|
|
||||||
.child(IconElement::new(self.icon).color(icon_color));
|
.child(IconElement::new(self.icon).color(icon_color));
|
||||||
|
|
||||||
if let Some(click_handler) = self.handlers.click.clone() {
|
if let Some(click_handler) = self.handlers.click.clone() {
|
||||||
|
|
|
@ -70,15 +70,15 @@ impl<S: 'static + Send + Sync> Key<S> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
div()
|
div()
|
||||||
.px_2()
|
.px_2()
|
||||||
.py_0()
|
.py_0()
|
||||||
.rounded_md()
|
.rounded_md()
|
||||||
.text_sm()
|
.text_sm()
|
||||||
.text_color(theme.lowest.on.default.foreground)
|
.text_color(color.text)
|
||||||
.bg(theme.lowest.on.default.background)
|
.bg(color.filled_element)
|
||||||
.child(self.key.clone())
|
.child(self.key.clone())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ impl<S: 'static + Send + Sync + Clone> ListHeader<S> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
let system_color = SystemColor::new();
|
let system_color = SystemColor::new();
|
||||||
let color = ThemeColor::new(cx);
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ impl<S: 'static + Send + Sync + Clone> ListSubHeader<S> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
h_stack().flex_1().w_full().relative().py_1().child(
|
h_stack().flex_1().w_full().relative().py_1().child(
|
||||||
div()
|
div()
|
||||||
|
@ -338,7 +338,7 @@ impl<S: 'static + Send + Sync + Clone> ListEntry<S> {
|
||||||
&mut self,
|
&mut self,
|
||||||
cx: &mut ViewContext<S>,
|
cx: &mut ViewContext<S>,
|
||||||
) -> Option<impl Element<ViewState = S>> {
|
) -> Option<impl Element<ViewState = S>> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
let disclosure_control_icon = if let Some(ToggleState::Toggled) = self.toggle {
|
let disclosure_control_icon = if let Some(ToggleState::Toggled) = self.toggle {
|
||||||
IconElement::new(Icon::ChevronDown)
|
IconElement::new(Icon::ChevronDown)
|
||||||
|
@ -360,7 +360,7 @@ impl<S: 'static + Send + Sync + Clone> ListEntry<S> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
let system_color = SystemColor::new();
|
let system_color = SystemColor::new();
|
||||||
let color = ThemeColor::new(cx);
|
let color = ThemeColor::new(cx);
|
||||||
let setting = user_settings();
|
let setting = user_settings();
|
||||||
|
@ -470,7 +470,7 @@ impl<S: 'static + Send + Sync + Clone> List<S> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
let is_toggleable = self.toggleable != Toggleable::NotToggleable;
|
let is_toggleable = self.toggleable != Toggleable::NotToggleable;
|
||||||
let is_toggled = Toggleable::is_toggled(&self.toggleable);
|
let is_toggled = Toggleable::is_toggled(&self.toggleable);
|
||||||
|
|
||||||
|
|
|
@ -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> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
v_stack()
|
v_stack()
|
||||||
.w_full()
|
.w_full()
|
||||||
|
@ -32,7 +32,7 @@ impl<S: 'static + Send + Sync + Clone> MultiBuffer<S> {
|
||||||
.items_center()
|
.items_center()
|
||||||
.justify_between()
|
.justify_between()
|
||||||
.p_4()
|
.p_4()
|
||||||
.bg(theme.lowest.base.default.background)
|
.bg(color.editor_subheader)
|
||||||
.child(Label::new("main.rs"))
|
.child(Label::new("main.rs"))
|
||||||
.child(IconButton::new(Icon::ArrowUpRight)),
|
.child(IconButton::new(Icon::ArrowUpRight)),
|
||||||
)
|
)
|
||||||
|
@ -67,7 +67,7 @@ mod stories {
|
||||||
_view: &mut S,
|
_view: &mut S,
|
||||||
cx: &mut ViewContext<S>,
|
cx: &mut ViewContext<S>,
|
||||||
) -> impl Element<ViewState = S> {
|
) -> impl Element<ViewState = S> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
Story::container(cx)
|
Story::container(cx)
|
||||||
.child(Story::title_for::<_, MultiBuffer<S>>(cx))
|
.child(Story::title_for::<_, MultiBuffer<S>>(cx))
|
||||||
|
|
|
@ -48,21 +48,21 @@ impl<S: 'static + Send + Sync + Clone> Palette<S> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
v_stack()
|
v_stack()
|
||||||
.w_96()
|
.w_96()
|
||||||
.rounded_lg()
|
.rounded_lg()
|
||||||
.bg(theme.lowest.base.default.background)
|
.bg(color.elevated_surface)
|
||||||
.border()
|
.border()
|
||||||
.border_color(theme.lowest.base.default.border)
|
.border_color(color.border)
|
||||||
.child(
|
.child(
|
||||||
v_stack()
|
v_stack()
|
||||||
.gap_px()
|
.gap_px()
|
||||||
.child(v_stack().py_0p5().px_1().child(div().px_2().py_0p5().child(
|
.child(v_stack().py_0p5().px_1().child(div().px_2().py_0p5().child(
|
||||||
Label::new(self.input_placeholder.clone()).color(LabelColor::Placeholder),
|
Label::new(self.input_placeholder.clone()).color(LabelColor::Placeholder),
|
||||||
)))
|
)))
|
||||||
.child(div().h_px().w_full().bg(theme.lowest.base.default.border))
|
.child(div().h_px().w_full().bg(color.filled_element))
|
||||||
.child(
|
.child(
|
||||||
v_stack()
|
v_stack()
|
||||||
.py_0p5()
|
.py_0p5()
|
||||||
|
@ -90,9 +90,8 @@ impl<S: 'static + Send + Sync + Clone> Palette<S> {
|
||||||
.px_2()
|
.px_2()
|
||||||
.py_0p5()
|
.py_0p5()
|
||||||
.rounded_lg()
|
.rounded_lg()
|
||||||
.hover(|style| style.bg(theme.lowest.base.hovered.background))
|
.hover(|style| style.bg(color.ghost_element_hover))
|
||||||
// .active()
|
// .active(|style| style.bg(color.ghost_element_active))
|
||||||
// .fill(theme.lowest.base.pressed.background)
|
|
||||||
.child(item.clone())
|
.child(item.clone())
|
||||||
})),
|
})),
|
||||||
),
|
),
|
||||||
|
@ -135,7 +134,7 @@ impl<S: 'static + Send + Sync + Clone> PaletteItem<S> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
div()
|
div()
|
||||||
.flex()
|
.flex()
|
||||||
|
|
|
@ -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> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
let panel_base;
|
let panel_base;
|
||||||
let current_width = self.width.unwrap_or(self.initial_width);
|
let current_width = self.width.unwrap_or(self.initial_width);
|
||||||
|
|
|
@ -43,7 +43,7 @@ impl<S: 'static + Send + Sync> Pane<S> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
fn render(&mut self, view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
div()
|
div()
|
||||||
.flex()
|
.flex()
|
||||||
|
@ -90,7 +90,7 @@ impl<S: 'static + Send + Sync> PaneGroup<S> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
fn render(&mut self, view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
if !self.panes.is_empty() {
|
if !self.panes.is_empty() {
|
||||||
let el = div()
|
let el = div()
|
||||||
|
|
|
@ -21,7 +21,7 @@ impl<S: 'static + Send + Sync + Clone> ProjectPanel<S> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
let color = ThemeColor::new(cx);
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
div()
|
div()
|
||||||
|
|
|
@ -87,7 +87,7 @@ impl StatusBar {
|
||||||
view: &mut Workspace,
|
view: &mut Workspace,
|
||||||
cx: &mut ViewContext<Workspace>,
|
cx: &mut ViewContext<Workspace>,
|
||||||
) -> impl Element<ViewState = Workspace> {
|
) -> impl Element<ViewState = Workspace> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
div()
|
div()
|
||||||
.py_0p5()
|
.py_0p5()
|
||||||
|
|
|
@ -75,7 +75,7 @@ impl<S: 'static + Send + Sync + Clone> Tab<S> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
let has_fs_conflict = self.fs_status == FileSystemStatus::Conflict;
|
let has_fs_conflict = self.fs_status == FileSystemStatus::Conflict;
|
||||||
let is_deleted = self.fs_status == FileSystemStatus::Deleted;
|
let is_deleted = self.fs_status == FileSystemStatus::Deleted;
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ impl<S: 'static + Send + Sync + Clone> TabBar<S> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
let can_navigate_back = true;
|
let can_navigate_back = true;
|
||||||
let can_navigate_forward = false;
|
let can_navigate_forward = false;
|
||||||
|
|
||||||
|
|
|
@ -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> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
let can_navigate_back = true;
|
let can_navigate_back = true;
|
||||||
let can_navigate_forward = false;
|
let can_navigate_forward = false;
|
||||||
|
|
|
@ -93,7 +93,7 @@ impl TitleBar {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element<ViewState = Self> {
|
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element<ViewState = Self> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
let color = ThemeColor::new(cx);
|
let color = ThemeColor::new(cx);
|
||||||
let setting = user_settings();
|
let setting = user_settings();
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ impl<S: 'static + Send + Sync> Toolbar<S> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
div()
|
div()
|
||||||
.bg(theme.highest.base.default.background)
|
.bg(theme.highest.base.default.background)
|
||||||
|
@ -98,7 +98,7 @@ mod stories {
|
||||||
_view: &mut S,
|
_view: &mut S,
|
||||||
cx: &mut ViewContext<S>,
|
cx: &mut ViewContext<S>,
|
||||||
) -> impl Element<ViewState = S> {
|
) -> impl Element<ViewState = S> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
Story::container(cx)
|
Story::container(cx)
|
||||||
.child(Story::title_for::<_, Toolbar<S>>(cx))
|
.child(Story::title_for::<_, Toolbar<S>>(cx))
|
||||||
|
|
|
@ -27,7 +27,7 @@ impl<S: 'static + Send + Sync> TrafficLight<S> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
let system_color = SystemColor::new();
|
let system_color = SystemColor::new();
|
||||||
|
|
||||||
let fill = match (self.window_has_focus, self.color) {
|
let fill = match (self.window_has_focus, self.color) {
|
||||||
|
@ -61,7 +61,7 @@ impl<S: 'static + Send + Sync> TrafficLights<S> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
div()
|
div()
|
||||||
.flex()
|
.flex()
|
||||||
|
|
|
@ -27,7 +27,7 @@ impl<S: 'static + Send + Sync> Avatar<S> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
let mut img = img();
|
let mut img = img();
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ impl<S: 'static + Send + Sync + Clone> Details<S> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
div()
|
div()
|
||||||
// .flex()
|
// .flex()
|
||||||
|
@ -60,7 +60,11 @@ mod stories {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
fn render(
|
||||||
|
&mut self,
|
||||||
|
_view: &mut S,
|
||||||
|
cx: &mut ViewContext<S>,
|
||||||
|
) -> impl Element<ViewState = S> {
|
||||||
Story::container(cx)
|
Story::container(cx)
|
||||||
.child(Story::title_for::<_, Details<S>>(cx))
|
.child(Story::title_for::<_, Details<S>>(cx))
|
||||||
.child(Story::label(cx, "Default"))
|
.child(Story::label(cx, "Default"))
|
||||||
|
|
|
@ -177,7 +177,7 @@ impl<S: 'static + Send + Sync> IconElement<S> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
let fill = self.color.color(theme);
|
let fill = self.color.color(theme);
|
||||||
let svg_size = match self.size {
|
let svg_size = match self.size {
|
||||||
IconSize::Small => ui_size(12. / 14.),
|
IconSize::Small => ui_size(12. / 14.),
|
||||||
|
|
|
@ -46,7 +46,7 @@ impl<S: 'static + Send + Sync> Input<S> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
let text_el;
|
let text_el;
|
||||||
let text_color;
|
let text_color;
|
||||||
|
|
|
@ -22,7 +22,7 @@ pub enum LabelColor {
|
||||||
|
|
||||||
impl LabelColor {
|
impl LabelColor {
|
||||||
pub fn hsla(&self, cx: &WindowContext) -> Hsla {
|
pub fn hsla(&self, cx: &WindowContext) -> Hsla {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
match self {
|
match self {
|
||||||
Self::Default => theme.middle.base.default.foreground,
|
Self::Default => theme.middle.base.default.foreground,
|
||||||
|
@ -82,7 +82,7 @@ impl<S: 'static + Send + Sync + Clone> Label<S> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
div()
|
div()
|
||||||
.when(self.strikethrough, |this| {
|
.when(self.strikethrough, |this| {
|
||||||
|
@ -136,7 +136,7 @@ impl<S: 'static + Send + Sync + Clone> HighlightedLabel<S> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
let highlight_color = theme.lowest.accent.default.foreground;
|
let highlight_color = theme.lowest.accent.default.foreground;
|
||||||
|
|
||||||
|
|
|
@ -139,13 +139,13 @@ impl Player {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn cursor_color<S: 'static>(&self, cx: &mut ViewContext<S>) -> Hsla {
|
pub fn cursor_color<S: 'static>(&self, cx: &mut ViewContext<S>) -> Hsla {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
let index = self.index % 8;
|
let index = self.index % 8;
|
||||||
theme.players[self.index].cursor
|
theme.players[self.index].cursor
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn selection_color<S: 'static>(&self, cx: &mut ViewContext<S>) -> Hsla {
|
pub fn selection_color<S: 'static>(&self, cx: &mut ViewContext<S>) -> Hsla {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
let index = self.index % 8;
|
let index = self.index % 8;
|
||||||
theme.players[self.index].selection
|
theme.players[self.index].selection
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ impl<S: 'static + Send + Sync> ToolDivider<S> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
div().w_px().h_3().bg(theme.lowest.base.default.border)
|
div().w_px().h_3().bg(theme.lowest.base.default.border)
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,27 @@ impl SystemColor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Copy)]
|
||||||
|
pub struct SyntaxColor {
|
||||||
|
pub comment: Hsla,
|
||||||
|
pub string: Hsla,
|
||||||
|
pub function: Hsla,
|
||||||
|
pub keyword: Hsla,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl SyntaxColor {
|
||||||
|
pub fn new(cx: &WindowContext) -> Self {
|
||||||
|
let theme = theme(cx);
|
||||||
|
|
||||||
|
Self {
|
||||||
|
comment: theme.syntax.comment,
|
||||||
|
string: theme.syntax.string,
|
||||||
|
function: theme.syntax.function,
|
||||||
|
keyword: theme.syntax.keyword,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
pub struct ThemeColor {
|
pub struct ThemeColor {
|
||||||
pub border: Hsla,
|
pub border: Hsla,
|
||||||
|
@ -63,12 +84,26 @@ pub struct ThemeColor {
|
||||||
pub filled_element_selected: Hsla,
|
pub filled_element_selected: Hsla,
|
||||||
pub filled_element_disabled: Hsla,
|
pub filled_element_disabled: Hsla,
|
||||||
pub ghost_element: Hsla,
|
pub ghost_element: Hsla,
|
||||||
|
/// The background color of a hovered element with no default background,
|
||||||
|
/// like a ghost-style button or an interactable list item.
|
||||||
/// - TODO: Map to step 3.
|
/// - TODO: Map to step 3.
|
||||||
pub ghost_element_hover: Hsla,
|
pub ghost_element_hover: Hsla,
|
||||||
/// - TODO: Map to step 4.
|
/// - TODO: Map to step 4.
|
||||||
pub ghost_element_active: Hsla,
|
pub ghost_element_active: Hsla,
|
||||||
pub ghost_element_selected: Hsla,
|
pub ghost_element_selected: Hsla,
|
||||||
pub ghost_element_disabled: Hsla,
|
pub ghost_element_disabled: Hsla,
|
||||||
|
pub text: Hsla,
|
||||||
|
pub text_muted: Hsla,
|
||||||
|
pub text_placeholder: Hsla,
|
||||||
|
pub text_disabled: Hsla,
|
||||||
|
pub icon_muted: Hsla,
|
||||||
|
pub syntax: SyntaxColor,
|
||||||
|
|
||||||
|
pub toolbar_background: Hsla,
|
||||||
|
pub editor_background: Hsla,
|
||||||
|
pub editor_subheader: Hsla,
|
||||||
|
pub editor_active_line: Hsla,
|
||||||
|
pub image_fallback_background: Hsla,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ThemeColor {
|
impl ThemeColor {
|
||||||
|
@ -94,6 +129,18 @@ impl ThemeColor {
|
||||||
ghost_element_active: theme.lowest.base.hovered.background,
|
ghost_element_active: theme.lowest.base.hovered.background,
|
||||||
ghost_element_selected: theme.lowest.accent.default.background,
|
ghost_element_selected: theme.lowest.accent.default.background,
|
||||||
ghost_element_disabled: system_color.transparent,
|
ghost_element_disabled: system_color.transparent,
|
||||||
|
text: theme.lowest.base.default.foreground,
|
||||||
|
text_muted: theme.lowest.variant.default.foreground,
|
||||||
|
/// TODO: map this to a real value
|
||||||
|
text_placeholder: theme.lowest.negative.default.foreground,
|
||||||
|
text_disabled: theme.lowest.base.disabled.foreground,
|
||||||
|
icon_muted: theme.lowest.variant.default.foreground,
|
||||||
|
syntax: SyntaxColor::new(cx),
|
||||||
|
toolbar_background: theme.highest.base.default.background,
|
||||||
|
editor_background: theme.highest.base.default.background,
|
||||||
|
editor_subheader: theme.middle.base.default.background,
|
||||||
|
editor_active_line: theme.highest.on.default.background,
|
||||||
|
image_fallback_background: theme.lowest.base.default.background,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -192,7 +239,7 @@ impl GitStatus {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn hsla(&self, cx: &WindowContext) -> Hsla {
|
pub fn hsla(&self, cx: &WindowContext) -> Hsla {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
let system_color = SystemColor::new();
|
let system_color = SystemColor::new();
|
||||||
|
|
||||||
match self {
|
match self {
|
||||||
|
|
|
@ -7,7 +7,7 @@ pub struct Story {}
|
||||||
|
|
||||||
impl Story {
|
impl Story {
|
||||||
pub fn container<S: 'static + Send + Sync>(cx: &mut ViewContext<S>) -> Div<S> {
|
pub fn container<S: 'static + Send + Sync>(cx: &mut ViewContext<S>) -> Div<S> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
div()
|
div()
|
||||||
.size_full()
|
.size_full()
|
||||||
|
@ -23,7 +23,7 @@ impl Story {
|
||||||
cx: &mut ViewContext<S>,
|
cx: &mut ViewContext<S>,
|
||||||
title: &str,
|
title: &str,
|
||||||
) -> impl Element<ViewState = S> {
|
) -> impl Element<ViewState = S> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
div()
|
div()
|
||||||
.text_xl()
|
.text_xl()
|
||||||
|
@ -41,7 +41,7 @@ impl Story {
|
||||||
cx: &mut ViewContext<S>,
|
cx: &mut ViewContext<S>,
|
||||||
label: &str,
|
label: &str,
|
||||||
) -> impl Element<ViewState = S> {
|
) -> impl Element<ViewState = S> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
div()
|
div()
|
||||||
.mt_4()
|
.mt_4()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue