This commit is contained in:
2026-10-08 08:51:11 +07:00
parent 2efb6ac5ca
commit f4b435b160
48 changed files with 211 additions and 222 deletions
+2 -2
View File
@@ -424,7 +424,7 @@ impl InteractiveElement for Avatar {
}
impl RenderOnce for Avatar {
fn render(self, window: &mut Window, cx: &mut App) -> impl IntoElement {
fn render(self, window: &mut Window, _cx: &mut App) -> impl IntoElement {
let border_width = if self.border_color.is_some() {
px(2.)
} else {
@@ -444,7 +444,7 @@ impl RenderOnce for Avatar {
.rounded_full()
.object_fit(ObjectFit::Cover)
.grayscale(grayscale)
.bg(cx.theme().ghost_element_background)
.bg(gpui::transparent_black())
.with_fallback(move || generated_avatar(seed.as_deref(), image_size))
.into_any_element()
}
+41 -41
View File
@@ -24,10 +24,10 @@ pub struct ButtonCustomVariant {
impl ButtonCustomVariant {
pub fn new(_window: &Window, cx: &App) -> Self {
Self {
color: cx.theme().element_background,
foreground: cx.theme().element_foreground,
hover: cx.theme().element_hover,
active: cx.theme().element_active,
color: cx.theme().accent.primary,
foreground: cx.theme().accent.on,
hover: cx.theme().accent.hover,
active: cx.theme().accent.active,
}
}
@@ -470,15 +470,15 @@ impl ButtonVariant {
fn bg_color(&self, cx: &App) -> Hsla {
match self {
ButtonVariant::Primary => cx.theme().element_background,
ButtonVariant::Secondary => cx.theme().secondary_background,
ButtonVariant::Danger => cx.theme().danger_background,
ButtonVariant::Warning => cx.theme().warning_background,
ButtonVariant::Primary => cx.theme().accent.primary,
ButtonVariant::Secondary => cx.theme().accent.wash,
ButtonVariant::Danger => cx.theme().danger,
ButtonVariant::Warning => cx.theme().warning,
ButtonVariant::Ghost { alt } => {
if *alt {
cx.theme().ghost_element_background_alt
cx.theme().raised
} else {
cx.theme().ghost_element_background
gpui::transparent_black()
}
}
ButtonVariant::Custom(colors) => colors.color,
@@ -488,11 +488,11 @@ impl ButtonVariant {
fn text_color(&self, cx: &App) -> Hsla {
match self {
ButtonVariant::Primary => cx.theme().element_foreground,
ButtonVariant::Secondary => cx.theme().secondary_foreground,
ButtonVariant::Danger => cx.theme().danger_foreground,
ButtonVariant::Warning => cx.theme().warning_foreground,
ButtonVariant::Transparent => cx.theme().text_placeholder,
ButtonVariant::Primary => cx.theme().accent.on,
ButtonVariant::Secondary => cx.theme().accent.text_on_wash,
ButtonVariant::Danger => cx.theme().accent.on_danger,
ButtonVariant::Warning => cx.theme().accent.on_danger,
ButtonVariant::Transparent => cx.theme().text_faint,
ButtonVariant::Ghost { alt } => {
if *alt {
cx.theme().text
@@ -506,19 +506,19 @@ impl ButtonVariant {
fn hovered(&self, cx: &App) -> ButtonVariantStyle {
let bg = match self {
ButtonVariant::Primary => cx.theme().element_hover,
ButtonVariant::Secondary => cx.theme().secondary_hover,
ButtonVariant::Danger => cx.theme().danger_hover,
ButtonVariant::Warning => cx.theme().warning_hover,
ButtonVariant::Ghost { .. } => cx.theme().ghost_element_hover,
ButtonVariant::Primary => cx.theme().accent.hover,
ButtonVariant::Secondary => cx.theme().accent.selection,
ButtonVariant::Danger => cx.theme().danger.opacity(0.15),
ButtonVariant::Warning => cx.theme().warning.opacity(0.15),
ButtonVariant::Ghost { .. } => cx.theme().hover,
ButtonVariant::Transparent => gpui::transparent_black(),
ButtonVariant::Custom(colors) => colors.hover,
};
let fg = match self {
ButtonVariant::Secondary => cx.theme().secondary_foreground,
ButtonVariant::Secondary => cx.theme().accent.text_on_wash,
ButtonVariant::Ghost { .. } => cx.theme().text,
ButtonVariant::Transparent => cx.theme().text_placeholder,
ButtonVariant::Transparent => cx.theme().text_faint,
_ => self.text_color(cx),
};
@@ -527,18 +527,18 @@ impl ButtonVariant {
fn active(&self, cx: &App) -> ButtonVariantStyle {
let bg = match self {
ButtonVariant::Primary => cx.theme().element_active,
ButtonVariant::Secondary => cx.theme().secondary_active,
ButtonVariant::Danger => cx.theme().danger_active,
ButtonVariant::Warning => cx.theme().warning_active,
ButtonVariant::Ghost { .. } => cx.theme().ghost_element_active,
ButtonVariant::Primary => cx.theme().accent.active,
ButtonVariant::Secondary => cx.theme().accent.selection,
ButtonVariant::Danger => cx.theme().danger.opacity(0.25),
ButtonVariant::Warning => cx.theme().warning.opacity(0.25),
ButtonVariant::Ghost { .. } => cx.theme().active,
ButtonVariant::Transparent => gpui::transparent_black(),
ButtonVariant::Custom(colors) => colors.active,
};
let fg = match self {
ButtonVariant::Secondary => cx.theme().secondary_foreground,
ButtonVariant::Transparent => cx.theme().text_placeholder,
ButtonVariant::Secondary => cx.theme().accent.text_on_wash,
ButtonVariant::Transparent => cx.theme().text_faint,
_ => self.text_color(cx),
};
@@ -547,18 +547,18 @@ impl ButtonVariant {
fn selected(&self, cx: &App) -> ButtonVariantStyle {
let bg = match self {
ButtonVariant::Primary => cx.theme().element_selected,
ButtonVariant::Secondary => cx.theme().secondary_selected,
ButtonVariant::Danger => cx.theme().danger_selected,
ButtonVariant::Warning => cx.theme().warning_selected,
ButtonVariant::Ghost { .. } => cx.theme().ghost_element_selected,
ButtonVariant::Primary => cx.theme().accent.selected,
ButtonVariant::Secondary => cx.theme().accent.selection,
ButtonVariant::Danger => cx.theme().danger.opacity(0.25),
ButtonVariant::Warning => cx.theme().warning.opacity(0.25),
ButtonVariant::Ghost { .. } => cx.theme().active,
ButtonVariant::Transparent => gpui::transparent_black(),
ButtonVariant::Custom(colors) => colors.active,
};
let fg = match self {
ButtonVariant::Secondary => cx.theme().secondary_foreground,
ButtonVariant::Transparent => cx.theme().text_placeholder,
ButtonVariant::Secondary => cx.theme().accent.text_on_wash,
ButtonVariant::Transparent => cx.theme().text_faint,
_ => self.text_color(cx),
};
@@ -567,11 +567,11 @@ impl ButtonVariant {
fn disabled(&self, cx: &App) -> ButtonVariantStyle {
let bg = match self {
ButtonVariant::Danger => cx.theme().danger_disabled,
ButtonVariant::Warning => cx.theme().warning_disabled,
ButtonVariant::Ghost { .. } => cx.theme().ghost_element_disabled,
ButtonVariant::Secondary => cx.theme().secondary_disabled,
_ => cx.theme().element_disabled,
ButtonVariant::Danger => cx.theme().danger.opacity(0.12),
ButtonVariant::Warning => cx.theme().warning.opacity(0.12),
ButtonVariant::Ghost { .. } => cx.theme().border.opacity(0.4),
ButtonVariant::Secondary => cx.theme().accent.wash.opacity(0.5),
_ => cx.theme().accent.primary.opacity(0.3),
};
let fg = match self {
+4 -4
View File
@@ -381,10 +381,10 @@ impl RenderOnce for Dialog {
.icon(IconName::CloseCircleFill)
.custom(
ButtonCustomVariant::new(window, cx)
.foreground(cx.theme().icon_muted)
.color(cx.theme().ghost_element_background)
.hover(cx.theme().ghost_element_background)
.active(cx.theme().ghost_element_background),
.foreground(cx.theme().text_faint)
.color(gpui::transparent_black())
.hover(gpui::transparent_black())
.active(gpui::transparent_black()),
)
.on_click(move |_, window, cx| {
on_cancel(&ClickEvent::default(), window, cx);
+6 -6
View File
@@ -446,7 +446,7 @@ impl TabGroupSkin {
.flex_grow_1()
.min_w_16()
.when(droppable, |this| {
this.drag_over::<DragPanel>(|this, _, _, cx| this.bg(cx.theme().surface_background))
this.drag_over::<DragPanel>(|this, _, _, cx| this.bg(cx.theme().accent.selection))
.on_drop({
let group = TabGroupContext::clone(group);
move |drag: &DragPanel, window, cx| {
@@ -465,7 +465,7 @@ impl TabGroupSkin {
let bar = TabBar::new("tab-bar")
.track_scroll(&self.scroll_handle)
.h(TABBAR_HEIGHT)
.bg(cx.theme().panel_background)
.bg(cx.theme().shell)
.when(needs_traffic_light_padding, |this| {
this.pl(px(TRAFFIC_LIGHT_PADDING))
})
@@ -567,7 +567,7 @@ impl TabGroupSkin {
h_flex()
.h(TABBAR_HEIGHT)
.w_full()
.bg(cx.theme().panel_background)
.bg(cx.theme().shell)
.child(bar.flex_1())
.child(window_controls())
.into_any_element()
@@ -717,7 +717,7 @@ impl TabGroupRenderer for TabGroupSkin {
.child(
div()
.size_full()
.bg(cx.theme().panel_background)
.bg(cx.theme().shell)
.overflow_hidden()
.child(panel.cached(StyleRefinement::default().v_flex().size_full())),
)
@@ -760,8 +760,8 @@ impl TabGroupRenderer for TabGroupSkin {
.h(height)
.rounded(cx.theme().radius_lg)
.border_1()
.border_color(cx.theme().element_disabled)
.bg(cx.theme().drop_target_background)
.border_color(cx.theme().accent.primary.opacity(0.3))
.bg(cx.theme().accent.selection)
.into_any_element(),
)
}
+1 -1
View File
@@ -106,7 +106,7 @@ impl RenderOnce for GroupBox {
fn render(self, _: &mut Window, cx: &mut App) -> impl IntoElement {
let (bg, has_paddings) = match self.variant {
GroupBoxVariant::Normal => (None, false),
GroupBoxVariant::Fill => (Some(cx.theme().surface_background), true),
GroupBoxVariant::Fill => (Some(cx.theme().shell), true),
};
v_flex()
+1 -1
View File
@@ -291,7 +291,7 @@ impl From<Icon> for AnyElement {
impl Render for Icon {
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
let text_color = self.text_color.unwrap_or_else(|| cx.theme().icon);
let text_color = self.text_color.unwrap_or_else(|| cx.theme().text_muted);
let text_size = window.text_style().font_size.to_pixels(window.rem_size());
let has_base_size = self.style.size.width.is_some() || self.style.size.height.is_some();
+1 -1
View File
@@ -11,5 +11,5 @@ pub(crate) fn clear_button(cx: &App) -> Button {
.ghost()
.xsmall()
.tab_stop(false)
.text_color(cx.theme().icon_muted)
.text_color(cx.theme().text_faint)
}
+4 -4
View File
@@ -16,9 +16,9 @@ use crate::{IconName, Selectable, Sizable, Size, StyleSized, StyledExt, h_flex,
/// The background of an input frame, which reads muted while the input is disabled.
fn input_background(disabled: bool, cx: &App) -> Hsla {
if disabled {
cx.theme().surface_background
cx.theme().shell
} else {
cx.theme().elevated_surface_background
cx.theme().input
}
}
@@ -32,9 +32,9 @@ fn input_editor_style(cx: &App) -> InputEditorStyle {
InputEditorStyle {
foreground: theme.text,
muted_foreground: theme.text_muted,
background: theme.elevated_surface_background,
background: theme.input,
border: theme.border,
selection: theme.selection,
selection: theme.accent.selection,
caret: theme.cursor,
..InputEditorStyle::default()
}
+1 -1
View File
@@ -199,7 +199,7 @@ impl RenderOnce for Kbd {
.border_1()
.border_color(cx.theme().border)
.text_color(cx.theme().text_muted)
.bg(cx.theme().surface_background)
.bg(cx.theme().shell)
.py_0p5()
.px_1()
.min_w_5()
+2 -2
View File
@@ -69,8 +69,8 @@ impl RenderedText {
TextViewStyle::default()
.with_foreground(theme.text)
.with_muted_foreground(theme.text_muted)
.with_link(theme.text_accent)
.with_code_background(theme.elevated_surface_background)
.with_link(theme.accent.primary)
.with_code_background(theme.raised)
.with_border(theme.border)
.with_code_block(code_block)
.with_dark(theme.is_dark()),
+4 -4
View File
@@ -104,12 +104,12 @@ impl RenderOnce for MenuItemElement {
})
.when(!self.disabled, |this| {
this.group_hover(self.group_name, |this| {
this.bg(cx.theme().secondary_background)
.text_color(cx.theme().secondary_foreground)
this.bg(cx.theme().accent.wash)
.text_color(cx.theme().accent.text_on_wash)
})
.when(self.selected, |this| {
this.bg(cx.theme().secondary_background)
.text_color(cx.theme().secondary_foreground)
this.bg(cx.theme().accent.selection)
.text_color(cx.theme().accent.text_on_wash)
})
.when_some(self.on_click, |this, on_click| {
this.on_mouse_down(MouseButton::Left, move |_, _, cx| {
+3 -3
View File
@@ -192,7 +192,7 @@ impl RenderOnce for MessageRow {
h_flex()
.gap_2()
.text_sm()
.text_color(cx.theme().text_placeholder)
.text_color(cx.theme().text_faint)
.when_some(author, |this, author| {
this.child(div().font_semibold().child(author))
})
@@ -212,7 +212,7 @@ impl RenderOnce for MessageRow {
.when_some(on_double_click, |this, listener| {
this.on_double_click(listener)
})
.hover(|this| this.bg(cx.theme().surface_background))
.hover(|this| this.bg(cx.theme().shell))
.into_any_element()
}
}
@@ -315,7 +315,7 @@ impl RenderOnce for WelcomeMessage {
this.child(
div()
.text_xs()
.text_color(cx.theme().text_placeholder)
.text_color(cx.theme().text_faint)
.child(message),
)
}),
+2 -4
View File
@@ -126,10 +126,8 @@ impl RenderOnce for Nav {
)
.when(clickable, |this| {
this.cursor_pointer()
.hover(|this| this.bg(cx.theme().ghost_element_hover))
.when(self.selected, |this| {
this.bg(cx.theme().ghost_element_active)
})
.hover(|this| this.bg(cx.theme().hover))
.when(self.selected, |this| this.bg(cx.theme().active))
})
.when_some(self.on_click, |this, handler| {
this.on_click(move |event, window, cx| handler(event, window, cx))
+2 -4
View File
@@ -119,10 +119,8 @@ impl RenderOnce for NavItem {
})
.when(clickable, |this| {
this.cursor_pointer()
.hover(|this| this.bg(cx.theme().ghost_element_hover))
.when(self.selected, |this| {
this.bg(cx.theme().ghost_element_active)
})
.hover(|this| this.bg(cx.theme().hover))
.when(self.selected, |this| this.bg(cx.theme().active))
})
.when_some(self.on_click, |this, handler| {
this.on_click(move |event, window, cx| handler(event, window, cx))
+7 -7
View File
@@ -43,16 +43,16 @@ impl NotificationKind {
match self {
Self::Info => Icon::new(IconName::Info)
.with_size(Size::Medium)
.text_color(cx.theme().icon),
.text_color(cx.theme().text_muted),
Self::Success => Icon::new(IconName::CheckCircle)
.with_size(Size::Medium)
.text_color(cx.theme().icon_accent),
.text_color(cx.theme().accent.primary),
Self::Warning => Icon::new(IconName::Warning)
.with_size(Size::Medium)
.text_color(cx.theme().text_warning),
.text_color(cx.theme().warning),
Self::Error => Icon::new(IconName::CloseCircle)
.with_size(Size::Medium)
.text_color(cx.theme().danger_foreground),
.text_color(cx.theme().danger),
}
}
}
@@ -300,12 +300,12 @@ impl Render for Notification {
};
let background = match self.kind {
Some(NotificationKind::Error) => cx.theme().danger_background,
_ => cx.theme().surface_background,
Some(NotificationKind::Error) => cx.theme().danger_muted,
_ => cx.theme().shell,
};
let text_color = match self.kind {
Some(NotificationKind::Error) => cx.theme().danger_foreground,
Some(NotificationKind::Error) => cx.theme().danger,
_ => cx.theme().text,
};
+2 -2
View File
@@ -12,7 +12,7 @@ pub(crate) fn resize_handle_appearance() -> ResizeHandleRenderer {
Rc::new(
|context: &ResizeHandleContext, _: &mut Window, cx: &mut App| {
let color = if context.is_active() {
cx.theme().border_selected
cx.theme().accent.primary
} else {
cx.theme().border
};
@@ -20,7 +20,7 @@ pub(crate) fn resize_handle_appearance() -> ResizeHandleRenderer {
Some(
div()
.bg(cx.theme().border_variant)
.bg(cx.theme().border)
.group_hover("handle", move |this| this.bg(color))
.when(axis.is_horizontal(), |this| this.h_full().w(HANDLE_SIZE))
.when(axis.is_vertical(), |this| this.w_full().h(HANDLE_SIZE))
+1 -1
View File
@@ -381,7 +381,7 @@ impl Render for Root {
})
.size_full()
.font_family(font_family)
.bg(cx.theme().surface_background)
.bg(cx.theme().shell)
.text_color(cx.theme().text)
.child(TextSelectionLayer)
.child(self.view.clone()),
+6 -6
View File
@@ -57,14 +57,14 @@ fn scrollbar<H: ScrollbarHandle + Clone>(
styles
.track(|track| {
track
.bg(theme.scrollbar_track_background)
.border_color(theme.scrollbar_thumb_border)
.bg(gpui::transparent_black())
.border_color(gpui::transparent_black())
.width(px(10.))
})
.track_hover(|track| track.bg(theme.scrollbar_thumb_background).width(px(10.)))
.track_hover(|track| track.bg(theme.border.opacity(0.7)).width(px(10.)))
.thumb(|thumb| {
thumb
.bg(theme.scrollbar_thumb_background)
.bg(theme.border.opacity(0.7))
.width(thumb_width)
.inset(px(1.))
.radius(thumb_radius)
@@ -72,14 +72,14 @@ fn scrollbar<H: ScrollbarHandle + Clone>(
})
.thumb_hover(|thumb| {
thumb
.bg(theme.scrollbar_thumb_hover_background)
.bg(theme.border_strong)
.width(px(8.))
.inset(px(1.))
.radius(px(4.))
})
.thumb_active(|thumb| {
thumb
.bg(theme.scrollbar_thumb_hover_background)
.bg(theme.border_strong)
.width(px(8.))
.inset(px(1.))
.radius(px(4.))
+1 -1
View File
@@ -15,7 +15,7 @@ pub fn v_flex() -> Div {
/// Returns a `Div` as divider.
pub fn divider(cx: &App) -> Div {
div().my_1().w_full().h_px().bg(cx.theme().border_variant)
div().my_1().w_full().h_px().bg(cx.theme().border)
}
macro_rules! font_weight {
+3 -3
View File
@@ -85,8 +85,8 @@ impl RenderOnce for Switch {
let on_click = self.on_click.clone();
let (bg, toggle_bg) = match checked {
true => (cx.theme().element_background, white()),
false => (cx.theme().elevated_surface_background, white()),
true => (cx.theme().accent.primary, white()),
false => (cx.theme().raised, white()),
};
let (bg, toggle_bg) = match self.disabled {
@@ -155,7 +155,7 @@ impl RenderOnce for Switch {
.flex()
.items_center()
.border(inset)
.border_color(cx.theme().border_transparent)
.border_color(gpui::transparent_black())
.bg(bg)
.when(!self.disabled, |this| this.cursor_pointer())
.child(
+6 -11
View File
@@ -193,9 +193,9 @@ impl RenderOnce for Tab {
let foreground = if disabled {
cx.theme().text_muted
} else if selected {
cx.theme().tab_active_foreground
cx.theme().text
} else {
cx.theme().tab_foreground
cx.theme().text_muted
};
let content = h_flex()
@@ -227,11 +227,11 @@ impl RenderOnce for Tab {
.h_6()
.rounded(cx.theme().radius)
.when(selected && !disabled, |this| {
this.bg(cx.theme().tab_active_background)
this.bg(cx.theme().background)
.when(cx.theme().shadow, |this| this.shadow_sm())
})
.when(!selected && !disabled, |this| {
this.hover(|this| this.bg(cx.theme().tab_hover_background))
this.hover(|this| this.bg(cx.theme().hover))
})
})
.when(!segmented, |this| {
@@ -243,14 +243,9 @@ impl RenderOnce for Tab {
.text_sm()
.rounded(cx.theme().radius)
.overflow_hidden()
.when(selected && !disabled, |this| {
this.bg(cx.theme().tab_background)
})
.when(selected && !disabled, |this| this.bg(cx.theme().shell))
.when(!selected && !disabled, |this| {
this.hover(|this| {
this.bg(cx.theme().tab_hover_background)
.text_color(cx.theme().tab_active_foreground)
})
this.hover(|this| this.bg(cx.theme().hover).text_color(cx.theme().text))
})
})
.when_some(prefix, |this, prefix| this.child(prefix))
+1 -3
View File
@@ -124,9 +124,7 @@ impl RenderOnce for TabBar {
.min_w_0()
.refine_style(&self.style)
.when(segmented, |this| {
this.bg(cx.theme().tab_background)
.p_0p5()
.rounded(cx.theme().radius)
this.bg(cx.theme().shell).p_0p5().rounded(cx.theme().radius)
})
.when_some(self.prefix, |this, prefix| this.child(prefix))
.child(
+5 -5
View File
@@ -79,7 +79,7 @@ impl ControlIcon {
#[inline]
fn hover_fg(&self, cx: &App) -> Hsla {
if self.is_close() {
cx.theme().danger_foreground
cx.theme().danger
} else {
cx.theme().text
}
@@ -88,18 +88,18 @@ impl ControlIcon {
#[inline]
fn hover_bg(&self, cx: &App) -> Hsla {
if self.is_close() {
cx.theme().danger_background
cx.theme().danger_muted
} else {
cx.theme().ghost_element_hover
cx.theme().hover
}
}
#[inline]
fn active_bg(&self, cx: &mut App) -> Hsla {
if self.is_close() {
cx.theme().danger_active
cx.theme().danger.opacity(0.25)
} else {
cx.theme().ghost_element_active
cx.theme().active
}
}
}
+1 -1
View File
@@ -25,7 +25,7 @@ impl Render for Tooltip {
.p_1p5()
.border_1()
.border_color(cx.theme().border)
.bg(cx.theme().surface_background)
.bg(cx.theme().shell)
.when(cx.theme().shadow, |this| this.shadow_sm())
.rounded(cx.theme().radius)
.text_xs()