Skip to content

armgit / muxin

Public Imported from GitHub
0

All your machines, one app. For you and your AI agents: agent sessions, desktops, files, logs and GitHub across your Macs, Linux and Windows machines, with an MCP server.

Terminal themes: Muxin drawn like a TUI in a terminal

Adib Hanna99ba73126acd
diff --git a/README.md b/README.md
index 52474d5..d810240 100644
--- a/README.md
+++ b/README.md
@@ -115,10 +115,10 @@ muxin status
- **Boxes (⌃3):** tasks you hand to an agent that works on them by itself, each in a container on one of your machines (see [Boxes](#boxes)). Below them, **Agents' workspaces**: folders that AI tools you use elsewhere work in through Muxin. Open one to see every command it ran, with its exit code and output, review its git changes, copy a shell command to step in, or destroy it.
- **Jobs:** queued and running self-hosted jobs, and which queued jobs no online runner can take.
- **Appearance:** follow the system, or pin light or dark, each with its own theme. Built-in themes:
- - dark: Muxin Graphite, macOS Dark, Gruvbox Dark, Catppuccin Mocha / Macchiato / Frappé, Tokyo Night, Nord, Rosé Pine, Solarized Dark, Dracula, Everforest Dark, Kanagawa Wave, GitHub Dark;
- - light: Muxin Paper, macOS Light, Gruvbox Light, Catppuccin Latte, Tokyo Night Day, Nord Light, Rosé Pine Dawn, Solarized Light, Everforest Light, Kanagawa Lotus, GitHub Light.
+ - dark: Muxin Graphite, macOS Dark, Gruvbox Dark, Catppuccin Mocha / Macchiato / Frappé, Tokyo Night, Nord, Rosé Pine, Solarized Dark, Dracula, Everforest Dark, Kanagawa Wave, GitHub Dark, Terminal, Terminal Midnight;
+ - light: Muxin Paper, macOS Light, Gruvbox Light, Catppuccin Latte, Tokyo Night Day, Nord Light, Rosé Pine Dawn, Solarized Light, Everforest Light, Kanagawa Lotus, GitHub Light, Terminal Paper.
- The macOS themes also switch to the system fonts (SF Pro, and SF Mono when it's installed). The choice is saved in `config.toml` (`[ui]`).
+ The macOS themes also switch to the system fonts (SF Pro, and SF Mono when it's installed). The Terminal themes make Muxin look like a TUI in a terminal: one monospace font, square corners, `[ Buttons ]` and `── Headings ──`. The choice is saved in `config.toml` (`[ui]`).
Keyboard: ⌘P goes to any machine, session or desktop by name, and ⇧⌘P (or ⌘P then `>`) runs any command, including **Theme: Choose…**, which previews each theme as you move through the list · ⌘1…⌘9 go to your machines · ⌃1…⌃7 overview, jobs, boxes, GitHub, usage, run, schedules (Alt on Linux and Windows) · ⌘J activity · ⌘R check machines · ⇧⌘R sync GitHub · ⌘N add machine · ⌘T new session · ⌘F or `/` search your machines and sessions · ⌘B sidebar · ⌘[ / ⌘] back / forward · ⌘, settings. Hold ⌘ to see them in the app, and change them in Settings › Keyboard. On Linux and Windows, use Ctrl instead of ⌘.
diff --git a/src/ui/about.rs b/src/ui/about.rs
index c12001c..49a3c0f 100644
--- a/src/ui/about.rs
+++ b/src/ui/about.rs
@@ -41,7 +41,7 @@ fn update_card(theme: &Theme, updates: &super::updates::Updates) -> Option<AnyEl
.flex()
.items_center()
.gap(px(8.))
- .child(div().px(px(10.)).py(px(6.)).rounded(px(6.)).bg(theme.element).font_family(super::theme::mono_font()).text_size(px(12.5)).text_color(theme.text).child(command))
+ .child(div().px(px(10.)).py(px(6.)).rounded(crate::ui::kit::corner(6.)).bg(theme.element).font_family(super::theme::mono_font()).text_size(px(12.5)).text_color(theme.text).child(command))
.child(Button::new("update-copy", "Copy").icon("copy").on_click(move |_, _, cx| cx.write_to_clipboard(gpui::ClipboardItem::new_string(copy.clone()))))
}))
.child(
@@ -226,11 +226,11 @@ impl Render for LicensesDialog {
.flex_col()
.gap(px(14.))
.p(px(18.))
- .rounded(px(10.))
+ .rounded(crate::ui::kit::corner(10.))
.bg(theme.elevated)
.border_1()
.border_color(theme.border)
- .shadow_lg()
+ .when(!crate::ui::kit::square(), |d| d.shadow_lg())
.text_color(theme.text)
.child(div().text_size(px(16.)).font_weight(FontWeight::SEMIBOLD).child("Licenses"))
.child(div().text_size(px(12.5)).text_color(theme.text_muted).child(
diff --git a/src/ui/activity.rs b/src/ui/activity.rs
index 2f71e99..be623d6 100644
--- a/src/ui/activity.rs
+++ b/src/ui/activity.rs
@@ -108,7 +108,7 @@ impl Root {
.flex()
.gap(px(2.))
.p(px(3.))
- .rounded(px(9.))
+ .rounded(crate::ui::kit::corner(9.))
.bg(theme.element)
.border_1()
.border_color(theme.border_variant)
@@ -120,11 +120,11 @@ impl Root {
.px(px(10.))
.flex()
.items_center()
- .rounded(px(7.))
+ .rounded(crate::ui::kit::corner(7.))
.cursor_pointer()
.text_size(px(12.5))
.text_color(if active { theme.text } else { theme.text_muted })
- .when(active, |d| d.bg(theme.surface).border_1().border_color(theme.border).shadow_sm())
+ .when(active, |d| d.bg(theme.surface).border_1().border_color(theme.border).when(!crate::ui::kit::square(), |d| d.shadow_sm()))
.child(label)
.on_click(cx.listener(move |this, _, _, cx| {
this.activity_filter = f;
@@ -325,7 +325,7 @@ impl Root {
.gap(px(10.))
.px(px(10.))
.py(px(8.))
- .rounded(px(8.))
+ .rounded(crate::ui::kit::corner(8.))
.cursor_pointer()
.when(selected, |d| d.bg(theme.element_selected))
.when(!selected, |d| d.hover(|st| st.bg(theme.ghost_hover)))
diff --git a/src/ui/box_dialog.rs b/src/ui/box_dialog.rs
index 2bb3ccc..99102a1 100644
--- a/src/ui/box_dialog.rs
+++ b/src/ui/box_dialog.rs
@@ -464,7 +464,7 @@ impl BoxDialog {
.gap(px(8.))
.h(px(30.))
.px(px(8.))
- .rounded(px(6.))
+ .rounded(crate::ui::kit::corner(6.))
.cursor_pointer()
.when(on, |d| d.bg(theme.element_selected))
.when(!on, |d| d.hover(|st| st.bg(theme.ghost_hover)))
@@ -493,7 +493,7 @@ impl Render for BoxDialog {
.flex()
.items_center()
.gap(px(6.))
- .rounded(px(6.))
+ .rounded(crate::ui::kit::corner(6.))
.border_1()
.text_size(px(12.5))
.border_color(if selected { theme.accent } else { theme.border_variant })
@@ -519,7 +519,7 @@ impl Render for BoxDialog {
let found = self.found(cx);
let rows: Vec<AnyElement> = found.iter().enumerate().map(|(i, f)| self.result_row(&theme, i, f, cx)).collect();
- let results = (!rows.is_empty()).then(|| div().flex().flex_col().p(px(4.)).rounded(px(8.)).border_1().border_color(theme.border_variant).bg(theme.surface).children(rows));
+ let results = (!rows.is_empty()).then(|| div().flex().flex_col().p(px(4.)).rounded(crate::ui::kit::corner(8.)).border_1().border_color(theme.border_variant).bg(theme.surface).children(rows));
let code: AnyElement = match self.source {
Source::GitHub => {
diff --git a/src/ui/boxes.rs b/src/ui/boxes.rs
index 3522492..a45b7ae 100644
--- a/src/ui/boxes.rs
+++ b/src/ui/boxes.rs
@@ -88,7 +88,7 @@ impl Root {
.flex_col()
.gap(px(10.))
.p(px(16.))
- .rounded(px(12.))
+ .rounded(crate::ui::kit::corner(12.))
.border_1()
.border_color(if b.attention.is_some() { theme.warning.opacity(0.6) } else { theme.border_variant })
.bg(theme.surface)
@@ -154,7 +154,7 @@ impl Root {
div()
.px(px(10.))
.py(px(7.))
- .rounded(px(8.))
+ .rounded(crate::ui::kit::corner(8.))
.bg(theme.sidebar)
.text_size(px(12.5))
.text_color(theme.text_muted)
diff --git a/src/ui/cloud_dialog.rs b/src/ui/cloud_dialog.rs
index d561b3d..9ade112 100644
--- a/src/ui/cloud_dialog.rs
+++ b/src/ui/cloud_dialog.rs
@@ -144,7 +144,7 @@ impl Render for CloudDialog {
.px(px(9.))
.flex()
.items_center()
- .rounded(px(6.))
+ .rounded(crate::ui::kit::corner(6.))
.border_1()
.cursor_pointer()
.text_size(px(12.5))
@@ -183,7 +183,7 @@ impl Render for CloudDialog {
.gap(px(10.))
.px(px(10.))
.h(px(30.))
- .rounded(px(6.))
+ .rounded(crate::ui::kit::corner(6.))
.cursor_pointer()
.border_1()
.border_color(if selected { theme.accent } else { theme.border_variant })
diff --git a/src/ui/compose.rs b/src/ui/compose.rs
index 9285811..bd9ce9c 100644
--- a/src/ui/compose.rs
+++ b/src/ui/compose.rs
@@ -328,7 +328,7 @@ pub fn diagram(g: &ComposeGraph, usage: &Usage, theme: &Theme, width: Rc<Cell<f3
.flex()
.items_center()
.gap(px(9.))
- .rounded(px(9.))
+ .rounded(crate::ui::kit::corner(9.))
.border_1()
.border_dashed()
.border_color(theme.info.opacity(0.55))
@@ -352,7 +352,7 @@ pub fn diagram(g: &ComposeGraph, usage: &Usage, theme: &Theme, width: Rc<Cell<f3
.h(px(16.))
.flex()
.items_center()
- .rounded(px(4.))
+ .rounded(crate::ui::kit::corner(4.))
.bg(theme.canvas)
.text_size(px(10.5))
.text_color(color)
@@ -468,7 +468,7 @@ fn service_box(n: usize, s: &ComposeService, spot: Spot, inline: bool, usage: &U
.flex()
.items_center()
.gap(px(4.))
- .rounded(px(5.))
+ .rounded(crate::ui::kit::corner(5.))
.bg(theme.accent.opacity(0.13))
.text_size(px(11.5))
.text_color(theme.text_accent)
@@ -489,7 +489,7 @@ fn service_box(n: usize, s: &ComposeService, spot: Spot, inline: bool, usage: &U
.h(px(20.))
.children(s.networks.iter().map(|name| {
let color = nets.get(name).copied().unwrap_or(theme.text_muted);
- div().flex_none().flex().items_center().gap(px(5.)).px(px(6.)).h(px(20.)).rounded(px(5.)).bg(color.opacity(0.13)).text_size(px(11.)).text_color(color).child(kit::dot(color, 6.)).child(name.clone())
+ div().flex_none().flex().items_center().gap(px(5.)).px(px(6.)).h(px(20.)).rounded(crate::ui::kit::corner(5.)).bg(color.opacity(0.13)).text_size(px(11.)).text_color(color).child(kit::dot(color, 6.)).child(name.clone())
}))
.into_any_element()
});
@@ -533,11 +533,11 @@ fn service_box(n: usize, s: &ComposeService, spot: Spot, inline: bool, usage: &U
.flex_col()
.gap(px(6.))
.overflow_hidden()
- .rounded(px(10.))
+ .rounded(crate::ui::kit::corner(10.))
.border_1()
.border_color(if failed { theme.error.opacity(0.6) } else { theme.border })
.bg(theme.surface)
- .shadow_sm()
+ .when(!crate::ui::kit::square(), |d| d.shadow_sm())
.child(
div()
.h(px(22.))
@@ -603,7 +603,7 @@ pub fn legend(g: &ComposeGraph, theme: &Theme) -> AnyElement {
.border_color(theme.border_variant)
.child(item(line(theme.text_placeholder), "waits for"))
.child(item(line(theme.success), "waits until healthy"))
- .child(item(div().w(px(16.)).h(px(10.)).rounded(px(3.)).border_1().border_dashed().border_color(theme.info).into_any_element(), "volume"))
+ .child(item(div().w(px(16.)).h(px(10.)).rounded(crate::ui::kit::corner(3.)).border_1().border_dashed().border_color(theme.info).into_any_element(), "volume"))
.child(item(icon("plug", 11., theme.text_accent).into_any_element(), "port on the machine"))
.when(shows && !nets.is_empty(), |d| {
d.child(div().text_size(px(11.5)).text_color(theme.text_placeholder).child("Networks"))
diff --git a/src/ui/desktop.rs b/src/ui/desktop.rs
index 6078660..76c07e8 100644
--- a/src/ui/desktop.rs
+++ b/src/ui/desktop.rs
@@ -606,7 +606,7 @@ impl DesktopView {
.gap(px(5.))
.h(px(24.))
.px(px(9.))
- .rounded(px(7.))
+ .rounded(crate::ui::kit::corner(7.))
.bg(gpui::black().opacity(0.62))
.border_1()
.border_color(gpui::white().opacity(0.18))
@@ -960,7 +960,7 @@ pub fn toolbar_with_menu(view: &Entity<DesktopView>, extra: Vec<AnyElement>, men
let default = displays.iter().find(|d| d.main && d.id != "all").or_else(|| displays.iter().find(|d| d.id != "all")).map(|d| d.id.clone());
let showing = shown.or(default);
let monitors = (displays.len() > 1).then(|| {
- div().flex().gap(px(2.)).p(px(2.)).rounded(px(7.)).bg(theme.element).children(displays.iter().map(|d| {
+ div().flex().gap(px(2.)).p(px(2.)).rounded(crate::ui::kit::corner(7.)).bg(theme.element).children(displays.iter().map(|d| {
let (on, id, view) = (showing.as_deref() == Some(d.id.as_str()), d.id.clone(), view.clone());
let right_click = menu.clone().filter(|_| d.id != "all").map(|menu| {
let (machine, display) = (machine.clone(), d.id.clone());
@@ -974,7 +974,7 @@ pub fn toolbar_with_menu(view: &Entity<DesktopView>, extra: Vec<AnyElement>, men
.flex()
.items_center()
.gap(px(5.))
- .rounded(px(5.))
+ .rounded(crate::ui::kit::corner(5.))
.cursor_pointer()
.text_size(px(11.5))
.text_color(if on { theme.text } else { theme.text_placeholder })
@@ -996,7 +996,7 @@ pub fn toolbar_with_menu(view: &Entity<DesktopView>, extra: Vec<AnyElement>, men
.h(px(22.))
.flex()
.items_center()
- .rounded(px(5.))
+ .rounded(crate::ui::kit::corner(5.))
.cursor_pointer()
.text_size(px(11.5))
.text_color(if on { theme.text } else { theme.text_placeholder })
@@ -1005,7 +1005,7 @@ pub fn toolbar_with_menu(view: &Entity<DesktopView>, extra: Vec<AnyElement>, men
.tooltip(move |window, cx| kit::Tooltip::view(tip.into(), window, cx))
.child(label)
};
- let group = |chips: Vec<gpui::Stateful<gpui::Div>>| div().flex_none().flex().gap(px(2.)).p(px(2.)).rounded(px(7.)).bg(theme.element).children(chips);
+ let group = |chips: Vec<gpui::Stateful<gpui::Div>>| div().flex_none().flex().gap(px(2.)).p(px(2.)).rounded(crate::ui::kit::corner(7.)).bg(theme.element).children(chips);
let sizes = screen.and_then(|d| {
let current = (d.width.round() as u32, d.height.round() as u32);
let mut choices: Vec<((u32, u32), String)> = SIZES.iter().filter(|(size, _)| d.any_size || d.modes.contains(size)).map(|(size, label)| (*size, label.to_string())).collect();
diff --git a/src/ui/detail.rs b/src/ui/detail.rs
index 0775925..c4fec4a 100644
--- a/src/ui/detail.rs
+++ b/src/ui/detail.rs
@@ -751,7 +751,7 @@ fn copyable(theme: &Theme, i: usize, text: String) -> impl IntoElement {
div()
.text_size(px(12.))
.text_color(theme.text_muted)
- .when(looks_like_command, |d| d.font_family(mono_font()).px(px(6.)).py(px(2.)).rounded(px(4.)).bg(theme.element))
+ .when(looks_like_command, |d| d.font_family(mono_font()).px(px(6.)).py(px(2.)).rounded(crate::ui::kit::corner(4.)).bg(theme.element))
.child(text),
)
.when(looks_like_command, |d| {
@@ -884,7 +884,7 @@ impl Root {
d.child(
div()
.p(px(8.))
- .rounded(px(6.))
+ .rounded(crate::ui::kit::corner(6.))
.bg(theme.element)
.font_family(mono_font())
.text_size(px(11.5))
diff --git a/src/ui/dialogs.rs b/src/ui/dialogs.rs
index 1393f0b..c271c2e 100644
--- a/src/ui/dialogs.rs
+++ b/src/ui/dialogs.rs
@@ -57,11 +57,11 @@ pub(super) fn frame(theme: &Theme, title: impl Into<SharedString>, intro: Option
.flex_col()
.gap(px(14.))
.p(px(18.))
- .rounded(px(10.))
+ .rounded(crate::ui::kit::corner(10.))
.bg(theme.elevated)
.border_1()
.border_color(theme.border)
- .shadow_lg()
+ .when(!crate::ui::kit::square(), |d| d.shadow_lg())
.text_color(theme.text)
.child(div().text_size(px(16.)).font_weight(FontWeight::SEMIBOLD).child(title.into()))
.children(intro.map(|t| div().text_size(px(12.5)).text_color(theme.text_muted).child(t)))
@@ -84,7 +84,7 @@ pub(super) fn error_line(theme: &Theme, error: &Option<String>) -> Option<impl I
.items_start()
.gap(px(8.))
.p(px(10.))
- .rounded(px(6.))
+ .rounded(crate::ui::kit::corner(6.))
.bg(theme.error.opacity(0.1))
.text_size(px(12.5))
.text_color(theme.text)
@@ -290,7 +290,7 @@ impl Render for AddMachineDialog {
.gap(px(10.))
.px(px(12.))
.py(px(9.))
- .rounded(px(9.))
+ .rounded(crate::ui::kit::corner(9.))
.border_1()
.border_color(if link.is_some() { theme.accent } else { theme.border_variant })
.bg(theme.surface)
@@ -317,7 +317,7 @@ fn suggestion(theme: &Theme, id: impl Into<gpui::ElementId>, text: impl Into<Sha
.gap(px(5.))
.h(px(24.))
.px(px(8.))
- .rounded(px(5.))
+ .rounded(crate::ui::kit::corner(5.))
.border_1()
.border_color(theme.border_variant)
.bg(theme.element)
@@ -462,7 +462,7 @@ impl Render for InstallDialog {
.items_center()
.gap(px(10.))
.p(px(10.))
- .rounded(px(6.))
+ .rounded(crate::ui::kit::corner(6.))
.bg(theme.warning.opacity(0.1))
.text_size(px(12.5))
.child(icon("triangle-alert", 14., theme.warning))
@@ -484,7 +484,7 @@ impl Render for InstallDialog {
.gap(px(6.))
.h(px(26.))
.px(px(10.))
- .rounded(px(6.))
+ .rounded(crate::ui::kit::corner(6.))
.border_1()
.cursor_pointer()
.border_color(if selected { theme.accent } else { theme.border_variant })
@@ -596,7 +596,7 @@ impl InstallDialog {
.items_start()
.gap(px(8.))
.p(px(9.))
- .rounded(px(8.))
+ .rounded(crate::ui::kit::corner(8.))
.border_1()
.cursor_pointer()
.border_color(if selected { theme.accent } else { theme.border_variant })
@@ -908,7 +908,7 @@ impl Render for AddDisplayDialog {
.items_center()
.gap(px(2.))
.py(px(8.))
- .rounded(px(7.))
+ .rounded(crate::ui::kit::corner(7.))
.border_1()
.border_color(if on { theme.accent } else { theme.border_variant })
.bg(if on { theme.accent.opacity(0.1) } else { theme.element })
@@ -1206,7 +1206,7 @@ impl NewWorkspaceDialog {
.items_start()
.gap(px(10.))
.p(px(10.))
- .rounded(px(8.))
+ .rounded(crate::ui::kit::corner(8.))
.border_1()
.cursor_pointer()
.border_color(if selected { theme.accent } else { theme.border_variant })
@@ -1245,7 +1245,7 @@ impl NewWorkspaceDialog {
.px(px(8.))
.flex()
.items_center()
- .rounded(px(5.))
+ .rounded(crate::ui::kit::corner(5.))
.border_1()
.border_color(theme.border_variant)
.bg(theme.element)
@@ -1304,7 +1304,7 @@ impl Render for NewWorkspaceDialog {
.gap(px(6.))
.h(px(26.))
.px(px(10.))
- .rounded(px(6.))
+ .rounded(crate::ui::kit::corner(6.))
.border_1()
.cursor_pointer()
.border_color(if selected { theme.accent } else { theme.border_variant })
@@ -1752,7 +1752,7 @@ impl NewSessionDialog {
.gap(px(5.))
.h(px(24.))
.px(px(8.))
- .rounded(px(5.))
+ .rounded(crate::ui::kit::corner(5.))
.bg(theme.element)
.border_1()
.border_color(theme.border_variant)
@@ -1799,7 +1799,7 @@ impl NewSessionDialog {
.flex_col()
.gap(px(6.))
.p(px(8.))
- .rounded(px(7.))
+ .rounded(crate::ui::kit::corner(7.))
.border_1()
.border_color(theme.border_variant)
.child(header)
@@ -1823,7 +1823,7 @@ impl NewSessionDialog {
.items_center()
.gap(px(10.))
.p(px(10.))
- .rounded(px(8.))
+ .rounded(crate::ui::kit::corner(8.))
.border_1()
.cursor_pointer()
.border_color(if selected { theme.accent } else { theme.border_variant })
@@ -1882,7 +1882,7 @@ impl NewSessionDialog {
.items_center()
.gap(px(10.))
.p(px(10.))
- .rounded(px(6.))
+ .rounded(crate::ui::kit::corner(6.))
.bg(theme.warning.opacity(0.10))
.text_size(px(12.5))
.child(icon("info", 14., theme.warning))
@@ -1955,7 +1955,7 @@ impl Render for NewSessionDialog {
.gap(px(6.))
.h(px(26.))
.px(px(10.))
- .rounded(px(6.))
+ .rounded(crate::ui::kit::corner(6.))
.border_1()
.cursor_pointer()
.border_color(if selected { theme.accent } else { theme.border_variant })
@@ -1999,7 +1999,7 @@ impl Render for NewSessionDialog {
.gap(px(6.))
.h(px(26.))
.px(px(10.))
- .rounded(px(6.))
+ .rounded(crate::ui::kit::corner(6.))
.border_1()
.border_dashed()
.cursor_pointer()
@@ -2046,7 +2046,7 @@ impl Render for NewSessionDialog {
.px(px(8.))
.flex()
.items_center()
- .rounded(px(5.))
+ .rounded(crate::ui::kit::corner(5.))
.border_1()
.cursor_pointer()
.text_size(px(12.))
@@ -2095,7 +2095,7 @@ impl Render for NewSessionDialog {
.flex_col()
.gap(px(8.))
.p(px(10.))
- .rounded(px(8.))
+ .rounded(crate::ui::kit::corner(8.))
.border_1()
.border_color(theme.border_variant)
.bg(theme.element.opacity(0.5))
@@ -2135,7 +2135,7 @@ impl Render for NewSessionDialog {
.items_center()
.gap(px(10.))
.p(px(10.))
- .rounded(px(8.))
+ .rounded(crate::ui::kit::corner(8.))
.border_1()
.cursor_pointer()
.border_color(if selected { theme.accent } else { theme.border_variant })
@@ -2194,7 +2194,7 @@ impl Render for NewSessionDialog {
.items_center()
.gap(px(5.))
.child(kit::color_icon(&theme, "clock", 11., theme.text_placeholder))
- .rounded(px(5.))
+ .rounded(crate::ui::kit::corner(5.))
.border_1()
.border_color(theme.border_variant)
.bg(theme.element)
@@ -2216,7 +2216,7 @@ impl Render for NewSessionDialog {
.items_start()
.gap(px(10.))
.p(px(10.))
- .rounded(px(6.))
+ .rounded(crate::ui::kit::corner(6.))
.bg(theme.warning.opacity(0.10))
.text_size(px(12.5))
.text_color(theme.text)
@@ -2269,7 +2269,7 @@ impl Render for NewSessionDialog {
}
div()
.p(px(10.))
- .rounded(px(6.))
+ .rounded(crate::ui::kit::corner(6.))
.bg(theme.element)
.border_1()
.border_color(theme.border_variant)
diff --git a/src/ui/files.rs b/src/ui/files.rs
index 69305ba..b70c0fb 100644
--- a/src/ui/files.rs
+++ b/src/ui/files.rs
@@ -249,7 +249,7 @@ impl CopyDialog {
.gap(px(6.))
.h(px(24.))
.px(px(9.))
- .rounded(px(6.))
+ .rounded(crate::ui::kit::corner(6.))
.border_1()
.cursor_pointer()
.text_size(px(12.))
@@ -296,7 +296,7 @@ impl CopyDialog {
.h(px(300.))
.overflow_y_scroll()
.track_scroll(&pane.scroll)
- .rounded(px(8.))
+ .rounded(crate::ui::kit::corner(8.))
.border_1()
.border_color(theme.border_variant)
.bg(theme.canvas)
@@ -335,7 +335,7 @@ impl CopyDialog {
.flex_none()
.items_center()
.justify_center()
- .rounded(px(4.))
+ .rounded(crate::ui::kit::corner(4.))
.border_1()
.border_color(if picked { theme.accent } else { theme.border })
.bg(if picked { theme.accent } else { theme.canvas })
@@ -410,11 +410,11 @@ impl Render for CopyDialog {
.flex_col()
.gap(px(14.))
.p(px(18.))
- .rounded(px(10.))
+ .rounded(crate::ui::kit::corner(10.))
.bg(theme.elevated)
.border_1()
.border_color(theme.border)
- .shadow_lg()
+ .when(!crate::ui::kit::square(), |d| d.shadow_lg())
.text_color(theme.text)
.on_key_down(cx.listener(|_, e: &gpui::KeyDownEvent, _, cx| {
if e.keystroke.key == "escape" {
diff --git a/src/ui/github.rs b/src/ui/github.rs
index 8414a28..c34c2dc 100644
--- a/src/ui/github.rs
+++ b/src/ui/github.rs
@@ -522,7 +522,7 @@ impl Root {
.pl(px(8.))
.pr(px(10.))
.py(px(4.))
- .rounded(px(8.))
+ .rounded(crate::ui::kit::corner(8.))
.cursor_pointer()
.hover(|st| st.bg(theme.ghost_hover))
.child(kit::tile("agent-github", TILE.0, TILE.1, 28.))
@@ -563,7 +563,7 @@ impl Root {
.h(px(30.))
.mx(px(10.))
.px(px(8.))
- .rounded(px(7.))
+ .rounded(crate::ui::kit::corner(7.))
.cursor_pointer()
.text_size(px(13.))
.text_color(if inbox_active { theme.text } else { theme.text_muted })
@@ -588,7 +588,7 @@ impl Root {
.flex()
.items_center()
.justify_center()
- .rounded(px(5.))
+ .rounded(crate::ui::kit::corner(5.))
.cursor_pointer()
.when(on, |d| d.bg(theme.element_selected))
.when(!on, |d| d.hover(|st| st.bg(theme.ghost_hover)))
@@ -603,7 +603,7 @@ impl Root {
.flex()
.gap(px(2.))
.p(px(2.))
- .rounded(px(7.))
+ .rounded(crate::ui::kit::corner(7.))
.bg(theme.element)
.child(option("gh-view-list", "list", "One list", !grouped, false))
.child(option("gh-view-owner", "layers", "Group by owner", grouped, true))
@@ -622,7 +622,7 @@ impl Root {
.mt(px(4.))
.mx(px(10.))
.px(px(8.))
- .rounded(px(7.))
+ .rounded(crate::ui::kit::corner(7.))
.cursor_pointer()
.overflow_hidden()
.hover(|st| st.bg(theme.ghost_hover))
@@ -665,7 +665,7 @@ impl Root {
.h(px(if owner_line { 40. } else { 30. }))
.mx(px(10.))
.px(px(8.))
- .rounded(px(7.))
+ .rounded(crate::ui::kit::corner(7.))
.cursor_pointer()
.when(selected, |d| d.bg(theme.element_selected))
.when(!selected, |d| d.hover(|st| st.bg(theme.ghost_hover)))
@@ -687,7 +687,7 @@ impl Root {
.flex()
.items_center()
.justify_center()
- .rounded(px(5.))
+ .rounded(crate::ui::kit::corner(5.))
.hover(|st| st.bg(theme.ghost_hover))
.when(!favorite, |d| d.invisible().group_hover("gh-repo-row", |st| st.visible()))
.child(icon(if favorite { "star-filled" } else { "star" }, 12., if favorite { theme.warning } else { theme.text_placeholder }))
@@ -862,11 +862,11 @@ impl Root {
.px(px(12.))
.flex()
.items_center()
- .rounded(px(7.))
+ .rounded(crate::ui::kit::corner(7.))
.cursor_pointer()
.text_size(px(12.5))
.text_color(if active { theme.text } else { theme.text_muted })
- .when(active, |d| d.bg(theme.surface).border_1().border_color(theme.border).shadow_sm())
+ .when(active, |d| d.bg(theme.surface).border_1().border_color(theme.border).when(!crate::ui::kit::square(), |d| d.shadow_sm()))
.child(label)
.on_click(cx.listener(move |this, _, _, cx| {
this.gh.tab = t;
@@ -877,7 +877,7 @@ impl Root {
.flex()
.gap(px(2.))
.p(px(3.))
- .rounded(px(9.))
+ .rounded(crate::ui::kit::corner(9.))
.bg(theme.element)
.border_1()
.border_color(theme.border_variant)
@@ -1267,7 +1267,7 @@ fn markdown(theme: &Theme, text: &str, width: f32) -> AnyElement {
div()
.w(px(width))
.p(px(10.))
- .rounded(px(6.))
+ .rounded(crate::ui::kit::corner(6.))
.bg(theme.element)
.font_family(mono_font())
.text_size(px(12.))
diff --git a/src/ui/input.rs b/src/ui/input.rs
index 6da565d..a8bf70f 100644
--- a/src/ui/input.rs
+++ b/src/ui/input.rs
@@ -396,7 +396,7 @@ impl TextInput {
.h(px(28.))
.mx(px(4.))
.px(px(10.))
- .rounded(px(6.))
+ .rounded(crate::ui::kit::corner(6.))
.text_size(px(13.))
.text_color(theme.text)
.when(!on, |d| d.opacity(0.4))
@@ -421,11 +421,11 @@ impl TextInput {
.occlude()
.w(px(190.))
.py(px(4.))
- .rounded(px(9.))
+ .rounded(crate::ui::kit::corner(9.))
.bg(theme.elevated)
.border_1()
.border_color(theme.border)
- .shadow_lg()
+ .when(!crate::ui::kit::square(), |d| d.shadow_lg())
.font_family(ui_font())
.children(rows)
.on_mouse_down_out(cx.listener(|this, _, _, cx| {
@@ -902,7 +902,7 @@ impl Render for TextInput {
.min_w(px(0.))
.h(px(28.))
.px(px(8.))
- .rounded(px(6.))
+ .rounded(crate::ui::kit::corner(6.))
.when(!self.bare, |d| d.border_1().border_color(if focused { theme.border_focused } else { theme.border_variant }).bg(theme.canvas))
.when(self.bare, |d| d.px(px(0.)))
.text_color(theme.text)
diff --git a/src/ui/kit.rs b/src/ui/kit.rs
index 84d3531..6ac13ef 100644
--- a/src/ui/kit.rs
+++ b/src/ui/kit.rs
@@ -104,11 +104,13 @@ pub struct Look {
text: Hsla,
muted: Hsla,
dark: bool,
+ /// The theme looks like a TUI (see `square`).
+ square: bool,
}
impl Look {
pub fn new(style: IconStyle, theme: &Theme) -> Look {
- Look { style, text: theme.text, muted: theme.text_muted, dark: theme.canvas.l < 0.5 }
+ Look { style, text: theme.text, muted: theme.text_muted, dark: theme.canvas.l < 0.5, square: theme.tui }
}
}
@@ -128,9 +130,21 @@ fn look() -> Look {
text: gpui::white(),
muted: gpui::hsla(0., 0., 0.62, 1.),
dark: true,
+ square: false,
})
}
+/// The theme looks like a TUI in a terminal: square corners, no shadows or
+/// gradients, `[ Buttons ]`, `── Headings ──` (and the monospace font, theme::apply).
+pub fn square() -> bool {
+ look().square
+}
+
+/// A corner's radius: `r`, or none in a TUI look.
+pub fn corner(r: f32) -> gpui::Pixels {
+ if square() { px(0.) } else { px(r) }
+}
+
pub fn icon_style() -> IconStyle {
look().style
}
@@ -292,7 +306,7 @@ pub fn dot(color: Hsla, size: f32) -> Div {
/// A runner as a small square: filled when connected, dashed outline when not.
pub fn runner_glyph(theme: &Theme, state: &str, size: f32) -> Div {
- let base = div().flex_none().size(px(size)).rounded(px(2.5));
+ let base = div().flex_none().size(px(size)).rounded(corner(2.5));
match state {
"working" | "idle" => base.bg(theme.state(state)),
_ => base.border_1().border_dashed().border_color(theme.text_placeholder),
@@ -306,7 +320,7 @@ pub fn pill(text: impl Into<SharedString>, color: Hsla) -> Div {
.h(px(18.))
.flex()
.items_center()
- .rounded(px(4.))
+ .rounded(corner(4.))
.bg(color.opacity(0.14))
.text_color(color)
.text_size(px(11.))
@@ -321,7 +335,7 @@ pub fn chip(theme: &Theme, text: impl Into<SharedString>) -> Div {
.h(px(18.))
.flex()
.items_center()
- .rounded(px(4.))
+ .rounded(corner(4.))
.border_1()
.border_color(theme.border_variant)
.bg(theme.element)
@@ -347,7 +361,7 @@ pub fn kbd(theme: &Theme, text: impl Into<SharedString>) -> Div {
.h(px(16.))
.flex()
.items_center()
- .rounded(px(3.))
+ .rounded(corner(3.))
.border_1()
.border_color(theme.border_variant)
.text_color(theme.text_placeholder)
@@ -369,10 +383,11 @@ pub fn meter(theme: &Theme, fraction: f32, color: Hsla) -> Div {
/// A bordered surface, the basic container for page sections.
pub fn card(theme: &Theme) -> Div {
- div().flex().flex_col().rounded(px(8.)).border_1().border_color(theme.border_variant).bg(theme.surface)
+ div().flex().flex_col().rounded(corner(8.)).border_1().border_color(theme.border_variant).bg(theme.surface)
}
pub fn section_title(theme: &Theme, title: impl Into<SharedString>, count: Option<usize>) -> Div {
+ let tui = square();
div()
.flex()
.items_center()
@@ -380,8 +395,16 @@ pub fn section_title(theme: &Theme, title: impl Into<SharedString>, count: Optio
.text_size(px(13.))
.font_weight(FontWeight::SEMIBOLD)
.text_color(theme.text)
+ // A TUI look: "── Title 3 ────────", the line running to the end of the row.
+ .when(tui, |d| d.child(div().flex_none().text_color(theme.text_placeholder).font_weight(FontWeight::NORMAL).child("──")))
.child(title.into())
.children(count.map(|n| div().font_family(mono_font()).text_color(theme.text_placeholder).font_weight(FontWeight::NORMAL).child(n.to_string())))
+ .when(tui, |d| d.child(rule_line(theme)))
+}
+
+/// The rest of a TUI heading's row: a line, like "────".
+fn rule_line(theme: &Theme) -> Div {
+ div().flex_1().min_w(px(8.)).h(px(1.)).bg(theme.border)
}
pub fn label(theme: &Theme, text: impl Into<SharedString>) -> Div {
@@ -503,15 +526,21 @@ impl RenderOnce for Button {
fn render(self, _: &mut Window, cx: &mut App) -> impl IntoElement {
let theme = cx.theme();
let icon_only = self.label.is_none();
- let (bg, hover, fg, border) = match self.style {
- ButtonStyle::Primary => (theme.accent, theme.accent.opacity(0.85), theme.accent_text, None),
- ButtonStyle::Outlined => (theme.element, theme.element_hover, theme.text, Some(theme.border_variant)),
- ButtonStyle::Ghost => (gpui::transparent_black(), theme.ghost_hover, theme.text_muted, None),
- ButtonStyle::Danger => (gpui::transparent_black(), theme.error.opacity(0.14), theme.error, None),
+ // A TUI look: "[ Label ]" in the button's color, nothing behind it.
+ let tui = square();
+ let (bg, hover, fg, border) = match (self.style, tui) {
+ (ButtonStyle::Primary, false) => (theme.accent, theme.accent.opacity(0.85), theme.accent_text, None),
+ (ButtonStyle::Outlined, false) => (theme.element, theme.element_hover, theme.text, Some(theme.border_variant)),
+ (ButtonStyle::Ghost, false) => (gpui::transparent_black(), theme.ghost_hover, theme.text_muted, None),
+ (ButtonStyle::Danger, false) => (gpui::transparent_black(), theme.error.opacity(0.14), theme.error, None),
+ (ButtonStyle::Primary, true) => (gpui::transparent_black(), theme.accent.opacity(0.16), theme.accent, None),
+ (ButtonStyle::Outlined, true) => (gpui::transparent_black(), theme.ghost_hover, theme.text, None),
+ (ButtonStyle::Ghost, true) => (gpui::transparent_black(), theme.ghost_hover, theme.text_muted, None),
+ (ButtonStyle::Danger, true) => (gpui::transparent_black(), theme.error.opacity(0.14), theme.error, None),
};
let disabled = self.disabled || self.loading;
// A theme with two brand colors fills primary buttons with both, as the icon does.
- let gradient = (self.style == ButtonStyle::Primary && theme.accent2 != theme.accent).then_some((theme.accent, theme.accent2));
+ let gradient = (!tui && self.style == ButtonStyle::Primary && theme.accent2 != theme.accent).then_some((theme.accent, theme.accent2));
let mut el = div()
.id(self.id.clone())
.flex()
@@ -521,8 +550,8 @@ impl RenderOnce for Button {
.gap(px(5.))
.h(px(26.))
.when(icon_only, |d| d.w(px(26.)))
- .when(!icon_only, |d| d.px(px(9.)))
- .rounded(px(6.))
+ .when(!icon_only, |d| d.px(px(if tui { 3. } else { 9. })))
+ .rounded(corner(6.))
.bg(bg)
.text_color(fg)
.text_size(px(12.5))
@@ -540,7 +569,7 @@ impl RenderOnce for Button {
}
if self.loading {
el = el.child(spinner(ElementId::Name(format!("{}-spin", self.id).into()), 13., fg));
- } else if let Some(i) = self.icon {
+ } else if let Some(i) = self.icon.filter(|_| icon_only || !tui) {
// Icons carry their own color, except on filled and danger buttons.
let color = match self.style {
ButtonStyle::Outlined | ButtonStyle::Ghost => tint(&theme, i).unwrap_or(fg),
@@ -549,7 +578,7 @@ impl RenderOnce for Button {
el = el.child(icon(i, if icon_only { 15. } else { 13. }, color));
}
if let Some(label) = self.label {
- el = el.child(label);
+ el = el.child(if tui { SharedString::from(format!("[ {label} ]")) } else { label });
}
if let Some(hint) = self.key_hint {
el = el.child(
@@ -596,11 +625,11 @@ impl Render for Tooltip {
div()
.px(px(8.))
.py(px(4.))
- .rounded(px(6.))
+ .rounded(corner(6.))
.bg(theme.elevated)
.border_1()
.border_color(theme.border)
- .shadow_md()
+ .when(!square(), |d| d.shadow_md())
.text_size(px(12.))
.text_color(theme.text)
.child(self.text.clone()),
@@ -630,7 +659,7 @@ pub fn checkbox(
.flex()
.items_center()
.justify_center()
- .rounded(px(4.))
+ .rounded(corner(4.))
.border_1()
.border_color(if checked { theme.accent } else { theme.border })
.bg(if checked { theme.accent } else { theme.canvas })
diff --git a/src/ui/logs.rs b/src/ui/logs.rs
index 860bb9a..e1d1775 100644
--- a/src/ui/logs.rs
+++ b/src/ui/logs.rs
@@ -545,7 +545,7 @@ impl Render for LogsView {
Tab::Docker => sources.docker.len(),
Tab::Services => sources.services.len(),
};
- let tabs = div().flex_none().flex().gap(px(2.)).p(px(2.)).rounded(px(7.)).bg(theme.element).children(
+ let tabs = div().flex_none().flex().gap(px(2.)).p(px(2.)).rounded(crate::ui::kit::corner(7.)).bg(theme.element).children(
[(Tab::System, "System"), (Tab::Files, "Files"), (Tab::Docker, "Docker"), (Tab::Services, "Services")].into_iter().map(|(tab, label)| {
let on = self.tab == tab;
let n = count(tab);
@@ -556,7 +556,7 @@ impl Render for LogsView {
.flex()
.items_center()
.gap(px(5.))
- .rounded(px(5.))
+ .rounded(crate::ui::kit::corner(5.))
.cursor_pointer()
.text_size(px(12.))
.text_color(if on { theme.text } else { theme.text_placeholder })
@@ -582,7 +582,7 @@ impl Render for LogsView {
let mut all: Vec<(Option<String>, String)> = vec![(None, "All".to_string())];
all.extend(self.services.iter().map(|s| (Some(s.clone()), s.clone())));
let services = self.services.clone();
- div().flex_none().flex().gap(px(2.)).p(px(2.)).rounded(px(7.)).bg(theme.element).children(all.into_iter().map(|(svc, label)| {
+ div().flex_none().flex().gap(px(2.)).p(px(2.)).rounded(crate::ui::kit::corner(7.)).bg(theme.element).children(all.into_iter().map(|(svc, label)| {
let on = self.only == svc;
let color = svc.as_deref().map(|s| service_color(s, &services));
div()
@@ -592,7 +592,7 @@ impl Render for LogsView {
.flex()
.items_center()
.gap(px(6.))
- .rounded(px(5.))
+ .rounded(crate::ui::kit::corner(5.))
.cursor_pointer()
.text_size(px(12.))
.text_color(if on { theme.text } else { theme.text_placeholder })
@@ -715,7 +715,7 @@ impl Render for LogsView {
.when(nested, |d| d.border_l_1().border_color(theme.border_variant).rounded_l_none())
.px(px(8.))
.py(px(5.))
- .rounded(px(6.))
+ .rounded(crate::ui::kit::corner(6.))
.cursor_pointer()
.when(on, |d| d.bg(theme.element_selected))
.when(!on, |d| d.hover(|st| st.bg(theme.ghost_hover)))
diff --git a/src/ui/menu.rs b/src/ui/menu.rs
index d5f1278..1965e7a 100644
--- a/src/ui/menu.rs
+++ b/src/ui/menu.rs
@@ -761,7 +761,7 @@ impl Root {
.h(px(28.))
.mx(px(4.))
.px(px(8.))
- .rounded(px(6.))
+ .rounded(crate::ui::kit::corner(6.))
.cursor_pointer()
.hover(|st| st.bg(theme.element_hover))
.text_size(px(13.))
@@ -779,11 +779,11 @@ impl Root {
.occlude()
.w(px(width))
.py(px(4.))
- .rounded(px(9.))
+ .rounded(crate::ui::kit::corner(9.))
.bg(theme.elevated)
.border_1()
.border_color(theme.border)
- .shadow_lg()
+ .when(!crate::ui::kit::square(), |d| d.shadow_lg())
.font_weight(FontWeight::NORMAL)
.children(rows);
Some(
diff --git a/src/ui/move_dialog.rs b/src/ui/move_dialog.rs
index 5ec78aa..05cc29c 100644
--- a/src/ui/move_dialog.rs
+++ b/src/ui/move_dialog.rs
@@ -66,7 +66,7 @@ impl Render for MoveDialog {
.flex()
.items_center()
.gap(px(6.))
- .rounded(px(6.))
+ .rounded(crate::ui::kit::corner(6.))
.border_1()
.text_size(px(12.5))
.cursor_pointer()
diff --git a/src/ui/overview.rs b/src/ui/overview.rs
index 7d81efb..ff29bb4 100644
--- a/src/ui/overview.rs
+++ b/src/ui/overview.rs
@@ -307,7 +307,7 @@ impl Root {
.flex_col()
.gap(px(12.))
.p(px(16.))
- .rounded(px(14.))
+ .rounded(crate::ui::kit::corner(14.))
.border_1()
.border_color(theme.border_variant)
.bg(theme.surface)
@@ -389,12 +389,12 @@ impl Root {
d.child(
div()
.w_full()
- .rounded(px(2.))
+ .rounded(crate::ui::kit::corner(2.))
.h(relative(frac.max(0.04)))
.bg(if last { theme.accent } else { theme.accent.opacity(0.45) }),
)
})
- .when(sample.is_none(), |d| d.child(div().w_full().h(px(2.)).rounded(px(1.)).bg(theme.track)))
+ .when(sample.is_none(), |d| d.child(div().w_full().h(px(2.)).rounded(crate::ui::kit::corner(1.)).bg(theme.track)))
.into_any_element()
})
.collect();
@@ -564,7 +564,7 @@ pub(super) fn callout(theme: &Theme, level: &str, title: impl Into<SharedString>
.pl(px(12.))
.pr(px(12.))
.py(px(10.))
- .rounded(px(10.))
+ .rounded(crate::ui::kit::corner(10.))
.border_1()
.border_color(theme.border_variant)
.bg(theme.surface)
@@ -572,7 +572,7 @@ pub(super) fn callout(theme: &Theme, level: &str, title: impl Into<SharedString>
div()
.flex_none()
.size(px(28.))
- .rounded(px(7.))
+ .rounded(crate::ui::kit::corner(7.))
.bg(color.opacity(0.16))
.flex()
.items_center()
diff --git a/src/ui/palette.rs b/src/ui/palette.rs
index 515babe..0942445 100644
--- a/src/ui/palette.rs
+++ b/src/ui/palette.rs
@@ -542,7 +542,7 @@ impl Root {
Glyph::Machine(name, (from, to)) => kit::tile(name, from, to, 22.).into_any_element(),
Glyph::Swatch(bg, accent) => div()
.size(px(22.))
- .rounded(px(6.))
+ .rounded(crate::ui::kit::corner(6.))
.border_1()
.border_color(theme.border)
.bg(gpui::rgb(bg))
@@ -567,7 +567,7 @@ impl Root {
.mx(px(ROW_INSET))
.px(px(ROW_PAD))
.when(item.indent, |d| d.pl(px(ROW_PAD + INDENT)))
- .rounded(px(8.))
+ .rounded(crate::ui::kit::corner(8.))
.cursor_pointer()
.when(i == selected, |d| d.bg(theme.element_selected))
.when(i != selected, |d| d.hover(|st| st.bg(theme.ghost_hover)))
@@ -604,11 +604,11 @@ impl Root {
.w(px(WIDTH))
.flex()
.flex_col()
- .rounded(px(12.))
+ .rounded(crate::ui::kit::corner(12.))
.bg(theme.elevated)
.border_1()
.border_color(theme.border)
- .shadow_lg()
+ .when(!crate::ui::kit::square(), |d| d.shadow_lg())
.font_weight(FontWeight::NORMAL)
.child(
div()
diff --git a/src/ui/ports.rs b/src/ui/ports.rs
index 3669b5f..e54e1a4 100644
--- a/src/ui/ports.rs
+++ b/src/ui/ports.rs
@@ -143,7 +143,7 @@ impl Root {
.gap(px(5.))
.px(px(8.))
.h(px(24.))
- .rounded(px(6.))
+ .rounded(crate::ui::kit::corner(6.))
.cursor_pointer()
.text_size(px(12.))
.text_color(theme.text_accent)
@@ -348,7 +348,7 @@ impl Root {
.mx(px(10.))
.pl(px(super::root::CHILD_PAD))
.pr(px(8.))
- .rounded(px(7.))
+ .rounded(crate::ui::kit::corner(7.))
.cursor_pointer()
.hover(|st| st.bg(theme.ghost_hover))
.tooltip(move |window, cx| kit::Tooltip::view(tip.clone().into(), window, cx))
diff --git a/src/ui/root.rs b/src/ui/root.rs
index e6d63b5..72ebe38 100644
--- a/src/ui/root.rs
+++ b/src/ui/root.rs
@@ -2357,7 +2357,7 @@ impl Root {
.gap(px(10.))
.h(px(30.))
.px(px(10.))
- .rounded(px(8.))
+ .rounded(crate::ui::kit::corner(8.))
.cursor_pointer()
.text_size(px(13.))
.text_color(if active { theme.text } else { theme.text_muted })
@@ -2392,7 +2392,7 @@ impl Root {
.gap(px(10.))
.h(px(30.))
.px(px(10.))
- .rounded(px(8.))
+ .rounded(crate::ui::kit::corner(8.))
.cursor_pointer()
.text_size(px(13.))
.text_color(if open { theme.text } else { theme.text_muted })
@@ -2422,9 +2422,11 @@ impl Root {
.text_size(px(11.5))
.font_weight(FontWeight::MEDIUM)
.text_color(theme.text_placeholder)
+ // A TUI look: "── Machines 4 ─────── +".
+ .when(kit::square(), |d| d.child("──"))
.child(title)
.children(count.map(|n| div().font_family(mono_font()).child(n.to_string())))
- .child(div().flex_1())
+ .child(div().flex_1().when(kit::square(), |d| d.h(px(1.)).mx(px(4.)).bg(theme.border)))
.children(add.map(|add| match add {
SectionAdd::Machine => Button::icon_only("sidebar-add-machine", "plus")
.tooltip(tip("Add machine", &super::shortcuts::label_for(cx, "add-machine")))
@@ -2476,7 +2478,7 @@ impl Root {
.h(px(44.))
.mx(px(10.))
.px(px(8.))
- .rounded(px(9.))
+ .rounded(crate::ui::kit::corner(9.))
.cursor_pointer()
.when(selected, |d| d.bg(theme.element_selected))
.when(!selected, |d| d.hover(|st| st.bg(theme.ghost_hover)))
@@ -2612,7 +2614,7 @@ impl Root {
.mx(px(10.))
.pl(px(CHILD_PAD))
.pr(px(8.))
- .rounded(px(7.))
+ .rounded(crate::ui::kit::corner(7.))
.cursor_pointer()
.when(selected, |d| d.bg(theme.element_selected))
.when(!selected, |d| d.hover(|st| st.bg(theme.ghost_hover)))
@@ -2693,7 +2695,7 @@ impl Root {
.mx(px(10.))
.pl(px(CHILD_PAD))
.pr(px(8.))
- .rounded(px(7.))
+ .rounded(crate::ui::kit::corner(7.))
.cursor_pointer()
.when(selected, |d| d.bg(theme.element_selected))
.when(!selected, |d| d.hover(|st| st.bg(theme.ghost_hover)))
@@ -2732,7 +2734,7 @@ impl Root {
.mx(px(10.))
.pl(px(CHILD_PAD))
.pr(px(8.))
- .rounded(px(7.))
+ .rounded(crate::ui::kit::corner(7.))
.cursor_pointer()
.when(selected, |d| d.bg(theme.element_selected))
.when(!selected, |d| d.hover(|st| st.bg(theme.ghost_hover)))
@@ -2923,7 +2925,7 @@ impl Root {
.gap(px(10.))
.px(px(10.))
.py(px(9.))
- .rounded(px(10.))
+ .rounded(crate::ui::kit::corner(10.))
.border_1()
.border_color(theme.border_variant)
.bg(theme.surface)
@@ -2961,13 +2963,13 @@ impl Root {
.gap(px(6.))
.h(px(26.))
.px(px(8.))
- .rounded(px(7.))
+ .rounded(crate::ui::kit::corner(7.))
.cursor_pointer()
.text_size(px(12.5))
.text_color(if active { theme.text } else { theme.text_muted })
.when(active, |d| d.bg(theme.element_selected))
.when(!active, |d| d.hover(|st| st.bg(theme.ghost_hover).text_color(theme.text)))
- .child(kit::color_icon(theme, icon_name, 13., theme.text_placeholder))
+ .child(kit::color_icon(theme, icon_name, 13., if active { theme.text } else { theme.text_placeholder }))
.child(label)
.on_click(cx.listener(move |this, _, window, cx| this.navigate(route.clone(), window, cx)))
};
@@ -2988,7 +2990,7 @@ impl Root {
.gap(px(5.))
.px(px(6.))
.py(px(3.))
- .rounded(px(5.))
+ .rounded(crate::ui::kit::corner(5.))
.cursor_pointer()
.text_size(px(11.5))
.text_color(theme.text_accent)
@@ -3105,11 +3107,11 @@ impl Root {
.gap(px(10.))
.px(px(14.))
.py(px(11.))
- .rounded(px(10.))
+ .rounded(crate::ui::kit::corner(10.))
.bg(theme.elevated)
.border_1()
.border_color(theme.border)
- .shadow_lg()
+ .when(!crate::ui::kit::square(), |d| d.shadow_lg())
.text_size(px(12.5))
.text_color(theme.text)
.child(div().flex_none().w(px(3.)).h(px(16.)).rounded_full().bg(color))
@@ -3230,7 +3232,7 @@ impl Root {
.mx(px(10.))
.pl(px(CHILD_PAD))
.pr(px(8.))
- .rounded(px(7.))
+ .rounded(crate::ui::kit::corner(7.))
.cursor_pointer()
.when(selected, |d| d.bg(theme.element_selected))
.when(!selected, |d| d.hover(|st| st.bg(theme.ghost_hover)))
@@ -3278,7 +3280,7 @@ impl Root {
.mx(px(10.))
.pl(px(CHILD_PAD))
.pr(px(8.))
- .rounded(px(7.))
+ .rounded(crate::ui::kit::corner(7.))
.cursor_pointer()
.when(selected, |d| d.bg(theme.element_selected))
.when(!selected, |d| d.hover(|st| st.bg(theme.ghost_hover)))
@@ -3349,7 +3351,7 @@ impl Root {
.mx(px(10.))
.pl(px(CHILD_PAD))
.pr(px(8.))
- .rounded(px(7.))
+ .rounded(crate::ui::kit::corner(7.))
.cursor_pointer()
.when(selected, |el| el.bg(theme.element_selected))
.when(!selected, |el| el.hover(|st| st.bg(theme.ghost_hover)))
@@ -3619,7 +3621,7 @@ impl Render for Root {
// Blocks the page; a click beside the dialog doesn't close it
// (and lose what was typed): Cancel, Escape or finishing it do.
.occlude()
- .child(div().id("modal").max_h(px(modal_max_height)).overflow_y_scroll().rounded(px(10.)).child(modal)),
+ .child(div().id("modal").max_h(px(modal_max_height)).overflow_y_scroll().rounded(crate::ui::kit::corner(10.)).child(modal)),
)
})
// Over everything, dialogs too: the edges to resize the window from.
@@ -3793,7 +3795,7 @@ fn tree_row(theme: &Theme, row: AnyElement, indent: f32, rails: &[usize], elbow:
.h(px(mid))
.border_l_1()
.border_b_1()
- .rounded_bl(px(5.))
+ .rounded_bl(crate::ui::kit::corner(5.))
.border_color(color)
// Not the last: the line goes on down past it.
.when(!last, |d| d.child(div().absolute().left(px(-1.)).top(px(mid)).w(px(1.)).h(px(height - mid)).bg(color)))
diff --git a/src/ui/run.rs b/src/ui/run.rs
index 3a3a499..4f4a272 100644
--- a/src/ui/run.rs
+++ b/src/ui/run.rs
@@ -96,7 +96,7 @@ impl Root {
.h(px(28.))
.pl(px(4.))
.pr(px(10.))
- .rounded(px(7.))
+ .rounded(crate::ui::kit::corner(7.))
.border_1()
.border_color(if on { theme.accent } else { theme.border_variant })
.bg(if on { theme.accent.opacity(0.10) } else { theme.element })
@@ -171,7 +171,7 @@ impl Root {
.h(px(24.))
.flex()
.items_center()
- .rounded(px(6.))
+ .rounded(crate::ui::kit::corner(6.))
.bg(theme.element)
.cursor_pointer()
.hover(|st| st.bg(theme.element_hover))
diff --git a/src/ui/schedule_dialog.rs b/src/ui/schedule_dialog.rs
index 31f04cb..eb96b03 100644
--- a/src/ui/schedule_dialog.rs
+++ b/src/ui/schedule_dialog.rs
@@ -169,7 +169,7 @@ impl Render for ScheduleDialog {
.flex()
.items_center()
.gap(px(6.))
- .rounded(px(6.))
+ .rounded(crate::ui::kit::corner(6.))
.border_1()
.cursor_pointer()
.text_size(px(12.5))
diff --git a/src/ui/schedules.rs b/src/ui/schedules.rs
index 2909e34..479c3ec 100644
--- a/src/ui/schedules.rs
+++ b/src/ui/schedules.rs
@@ -333,7 +333,7 @@ impl Root {
.gap(px(5.))
.h(px(24.))
.px(px(8.))
- .rounded(px(6.))
+ .rounded(crate::ui::kit::corner(6.))
.border_1()
.border_color(if selected { theme.accent } else { theme.border_variant })
.bg(if selected { theme.accent.opacity(0.10) } else { theme.element })
@@ -364,7 +364,7 @@ impl Root {
.max_h(px(280.))
.overflow_y_scroll()
.p(px(10.))
- .rounded(px(8.))
+ .rounded(crate::ui::kit::corner(8.))
.bg(theme.canvas)
.border_1()
.border_color(theme.border_variant)
diff --git a/src/ui/services.rs b/src/ui/services.rs
index 73dcc3a..ae7797e 100644
--- a/src/ui/services.rs
+++ b/src/ui/services.rs
@@ -611,7 +611,7 @@ fn chip(theme: &Theme, id: String, label: impl Into<SharedString>, on: bool) ->
.flex()
.items_center()
.gap(px(5.))
- .rounded(px(5.))
+ .rounded(crate::ui::kit::corner(5.))
.cursor_pointer()
.text_size(px(12.))
.text_color(if on { theme.text } else { theme.text_placeholder })
@@ -652,7 +652,7 @@ impl Render for ServicesView {
tab_list.extend([(Tab::Compose, "Compose", data.compose.len()), (Tab::Images, "Images", data.images.len())]);
}
tab_list.push((Tab::Processes, "Processes", self.procs.as_ref().and_then(|p| p.as_ref().ok()).map(|p| p.total).unwrap_or(0)));
- let tabs = div().flex_none().flex().gap(px(2.)).p(px(2.)).rounded(px(7.)).bg(theme.element).children(tab_list.into_iter().map(|(tab, label, n)| {
+ let tabs = div().flex_none().flex().gap(px(2.)).p(px(2.)).rounded(crate::ui::kit::corner(7.)).bg(theme.element).children(tab_list.into_iter().map(|(tab, label, n)| {
chip(&theme, format!("svc-tab-{label}"), label, self.tab == tab)
.when(n > 0, |d| d.child(div().text_size(px(10.5)).text_color(theme.text_placeholder).child(n.to_string())))
.on_click(cx.listener(move |this, _, _, cx| {
@@ -826,7 +826,7 @@ impl Render for ServicesView {
let run_form = self.run.as_ref().filter(|_| self.tab == Tab::Containers).map(|f| {
let field = |label: &'static str, input: &Entity<TextInput>, w: f32| div().flex().flex_col().gap(px(4.)).child(div().text_size(px(11.)).text_color(theme.text_placeholder).child(label)).child(div().w(px(w)).child(input.clone()));
let restarts = div().flex().flex_col().gap(px(4.)).child(div().text_size(px(11.)).text_color(theme.text_placeholder).child("Restart")).child(
- div().flex().gap(px(2.)).p(px(2.)).rounded(px(7.)).bg(theme.element).children([("no", "Never"), ("always", "Always"), ("unless-stopped", "Unless stopped"), ("on-failure", "On failure")].into_iter().map(|(value, label)| {
+ div().flex().gap(px(2.)).p(px(2.)).rounded(crate::ui::kit::corner(7.)).bg(theme.element).children([("no", "Never"), ("always", "Always"), ("unless-stopped", "Unless stopped"), ("on-failure", "On failure")].into_iter().map(|(value, label)| {
chip(&theme, format!("svc-restart-{value}"), label, f.restart == value).on_click(cx.listener(move |this, _, _, cx| {
if let Some(f) = &mut this.run {
f.restart = value;
@@ -1292,7 +1292,7 @@ impl ServicesView {
.h(px(20.))
.flex()
.items_center()
- .rounded(px(5.))
+ .rounded(crate::ui::kit::corner(5.))
.cursor_pointer()
.text_size(px(11.))
.border_1()
@@ -1435,7 +1435,7 @@ impl ServicesView {
.child(kit::dot(if running { theme.success } else { theme.text_placeholder }, 8.))
.child(div().flex_none().text_size(px(14.)).font_weight(gpui::FontWeight::SEMIBOLD).text_color(theme.text).child(name.clone()))
.child(div().flex_none().text_size(px(12.)).text_color(theme.text_muted).child(project.status.clone()))
- .child(div().flex_none().ml(px(6.)).flex().gap(px(2.)).p(px(2.)).rounded(px(7.)).bg(theme.element).children(
+ .child(div().flex_none().ml(px(6.)).flex().gap(px(2.)).p(px(2.)).rounded(crate::ui::kit::corner(7.)).bg(theme.element).children(
[(ProjectMode::Picture, "Picture", "workflow"), (ProjectMode::List, "List", "list"), (ProjectMode::Logs, "Logs", "scroll-text")].into_iter().map(|(mode, label, glyph)| {
let on = self.project_mode == mode;
div()
@@ -1445,7 +1445,7 @@ impl ServicesView {
.flex()
.items_center()
.gap(px(6.))
- .rounded(px(5.))
+ .rounded(crate::ui::kit::corner(5.))
.cursor_pointer()
.text_size(px(12.))
.text_color(if on { theme.text } else { theme.text_placeholder })
@@ -2047,7 +2047,7 @@ fn gpu_strip(gpus: &[Gpu], theme: &Theme) -> AnyElement {
.gap(px(10.))
.px(px(12.))
.py(px(8.))
- .rounded(px(8.))
+ .rounded(crate::ui::kit::corner(8.))
.border_1()
.border_color(theme.border_variant)
.bg(theme.surface)
diff --git a/src/ui/sessions.rs b/src/ui/sessions.rs
index b8dabff..7d05a29 100644
--- a/src/ui/sessions.rs
+++ b/src/ui/sessions.rs
@@ -550,7 +550,7 @@ impl Root {
.gap(px(4.))
.px(px(6.))
.h(px(18.))
- .rounded(px(4.))
+ .rounded(crate::ui::kit::corner(4.))
.bg(theme.accent.opacity(0.12))
.text_size(px(11.))
.text_color(theme.text_accent)
@@ -825,7 +825,7 @@ impl Root {
.gap(px(8.))
.px(px(14.))
.py(px(8.))
- .rounded(px(8.))
+ .rounded(crate::ui::kit::corner(8.))
.bg(theme.elevated)
.border_1()
.border_color(theme.border_variant)
@@ -897,7 +897,7 @@ impl Root {
.id(SharedString::from(format!("pane-close-{id}")))
.flex_none()
.p(px(3.))
- .rounded(px(4.))
+ .rounded(crate::ui::kit::corner(4.))
.cursor_pointer()
.hover(|st| st.bg(theme.ghost_hover))
.tooltip(|window, cx| kit::Tooltip::view("Close the pane (the session keeps running)".into(), window, cx))
@@ -954,7 +954,7 @@ impl Root {
.mx(px(10.))
.pl(px(super::root::CHILD_PAD))
.pr(px(8.))
- .rounded(px(7.))
+ .rounded(crate::ui::kit::corner(7.))
.cursor_pointer()
.when(selected, |d| d.bg(theme.element_selected))
.when(!selected, |d| d.hover(|st| st.bg(theme.ghost_hover)))
@@ -1876,7 +1876,7 @@ pub(super) fn git_line(theme: &Theme, key: &str, g: &GitStatus, full: bool) -> g
.gap(px(4.))
.px(px(6.))
.h(px(18.))
- .rounded(px(4.))
+ .rounded(crate::ui::kit::corner(4.))
.bg(color.opacity(0.12))
.cursor_pointer()
.hover(|st| st.bg(color.opacity(0.22)))
diff --git a/src/ui/settings.rs b/src/ui/settings.rs
index c7eaa18..d6c2aba 100644
--- a/src/ui/settings.rs
+++ b/src/ui/settings.rs
@@ -360,7 +360,7 @@ impl SettingsPage {
.h(px(26.))
.pl(px(8.))
.pr(px(2.))
- .rounded(px(5.))
+ .rounded(crate::ui::kit::corner(5.))
.border_1()
.border_color(theme.border_variant)
.bg(theme.element)
@@ -539,7 +539,7 @@ impl SettingsPage {
.items_center()
.gap(px(12.))
.p(px(12.))
- .rounded(px(8.))
+ .rounded(crate::ui::kit::corner(8.))
.bg(theme.warning.opacity(0.10))
.child(icon("triangle-alert", 15., theme.warning))
.child(
@@ -570,7 +570,7 @@ impl SettingsPage {
.gap(px(5.))
.h(px(24.))
.px(px(8.))
- .rounded(px(5.))
+ .rounded(crate::ui::kit::corner(5.))
.border_1()
.border_color(theme.border_variant)
.bg(theme.element)
@@ -726,7 +726,7 @@ impl SettingsPage {
.flex()
.items_center()
.gap(px(6.))
- .rounded(px(6.))
+ .rounded(crate::ui::kit::corner(6.))
.border_1()
.cursor_pointer()
.border_color(if selected { theme.accent } else { theme.border_variant })
@@ -758,7 +758,7 @@ impl SettingsPage {
.px(px(9.))
.flex()
.items_center()
- .rounded(px(6.))
+ .rounded(crate::ui::kit::corner(6.))
.cursor_pointer()
.text_size(px(12.))
.text_color(if selected { theme.text } else { theme.text_muted })
@@ -806,7 +806,7 @@ impl SettingsPage {
let preview = div()
.mt(px(4.))
.p(px(12.))
- .rounded(px(8.))
+ .rounded(crate::ui::kit::corner(8.))
.bg(theme.canvas)
.border_1()
.border_color(theme.border_variant)
@@ -861,11 +861,11 @@ impl SettingsPage {
.gap(px(6.))
.h(px(28.))
.px(px(12.))
- .rounded(px(7.))
+ .rounded(crate::ui::kit::corner(7.))
.cursor_pointer()
.text_size(px(12.5))
.text_color(if selected { theme.text } else { theme.text_muted })
- .when(selected, |d| d.bg(theme.surface).border_1().border_color(theme.border).shadow_sm())
+ .when(selected, |d| d.bg(theme.surface).border_1().border_color(theme.border).when(!crate::ui::kit::square(), |d| d.shadow_sm()))
.when(!selected, |d| d.hover(|st| st.text_color(theme.text)))
.child(kit::color_icon(theme, icon_name, 13., if selected { theme.text_accent } else { theme.text_placeholder }))
.child(label)
@@ -905,7 +905,7 @@ impl SettingsPage {
.flex()
.gap(px(2.))
.p(px(3.))
- .rounded(px(9.))
+ .rounded(crate::ui::kit::corner(9.))
.bg(theme.element)
.border_1()
.border_color(theme.border_variant)
@@ -936,7 +936,7 @@ impl SettingsPage {
.flex_col()
.gap(px(8.))
.p(px(10.))
- .rounded(px(9.))
+ .rounded(crate::ui::kit::corner(9.))
.border_1()
.cursor_pointer()
.border_color(if selected { theme.accent } else { theme.border_variant })
@@ -1099,7 +1099,7 @@ impl SettingsPage {
.py(px(12.))
.gap(px(8.))
// As wide as its choices (a row keeps it from stretching).
- .child(div().flex().child(div().flex().gap(px(2.)).p(px(2.)).rounded(px(7.)).bg(theme.element).children(options.into_iter().map(|(id, name)| {
+ .child(div().flex().child(div().flex().gap(px(2.)).p(px(2.)).rounded(crate::ui::kit::corner(7.)).bg(theme.element).children(options.into_iter().map(|(id, name)| {
let on = chosen == id;
let engine = self.engine.clone();
div()
@@ -1108,7 +1108,7 @@ impl SettingsPage {
.h(px(24.))
.flex()
.items_center()
- .rounded(px(5.))
+ .rounded(crate::ui::kit::corner(5.))
.cursor_pointer()
.text_size(px(12.))
.text_color(if on { theme.text } else { theme.text_placeholder })
@@ -1173,11 +1173,11 @@ impl Render for SettingsPage {
.gap(px(7.))
.h(px(30.))
.px(px(12.))
- .rounded(px(7.))
+ .rounded(crate::ui::kit::corner(7.))
.cursor_pointer()
.text_size(px(13.))
.text_color(if selected { theme.text } else { theme.text_muted })
- .when(selected, |d| d.bg(theme.surface).border_1().border_color(theme.border).shadow_sm())
+ .when(selected, |d| d.bg(theme.surface).border_1().border_color(theme.border).when(!crate::ui::kit::square(), |d| d.shadow_sm()))
.when(!selected, |d| d.hover(|st| st.text_color(theme.text)))
.child(icon(tab.icon(), 14., if selected { theme.text } else { theme.text_placeholder }))
.child(tab.label())
@@ -1186,7 +1186,7 @@ impl Render for SettingsPage {
})
.collect();
let bar = div().flex_none().px(px(28.)).pt(px(18.)).pb(px(14.)).border_b_1().border_color(theme.border_variant).child(
- div().flex().w_full().max_w(px(760.)).gap(px(2.)).p(px(3.)).rounded(px(9.)).bg(theme.element).border_1().border_color(theme.border_variant).children(tabs),
+ div().flex().w_full().max_w(px(760.)).gap(px(2.)).p(px(3.)).rounded(crate::ui::kit::corner(9.)).bg(theme.element).border_1().border_color(theme.border_variant).children(tabs),
);
let body = div().w_full().max_w(px(760.)).flex().flex_col().gap(px(28.));
let body = match self.tab {
@@ -1236,7 +1236,7 @@ impl SettingsPage {
.flex()
.items_center()
.justify_center()
- .rounded(px(5.))
+ .rounded(crate::ui::kit::corner(5.))
.border_1()
.border_color(if on { theme.accent } else { theme.border_variant })
.bg(if on { theme.accent.opacity(0.12) } else { theme.element })
@@ -1270,7 +1270,7 @@ impl SettingsPage {
.flex()
.items_center()
.justify_center()
- .rounded(px(5.))
+ .rounded(crate::ui::kit::corner(5.))
.border_1()
.cursor_pointer()
.font_family(mono_font())
@@ -1457,7 +1457,7 @@ fn hint_line(theme: &Theme, i: usize, hint: String) -> impl IntoElement {
.items_center()
.gap(px(6.))
.pl(px(24.))
- .child(mono(hint).text_size(px(12.)).px(px(6.)).py(px(2.)).rounded(px(4.)).bg(theme.element).text_color(theme.text_muted))
+ .child(mono(hint).text_size(px(12.)).px(px(6.)).py(px(2.)).rounded(crate::ui::kit::corner(4.)).bg(theme.element).text_color(theme.text_muted))
.child(Button::icon_only(("hint-copy", i), "copy").tooltip("Copy").on_click(move |_, _, cx| {
cx.write_to_clipboard(gpui::ClipboardItem::new_string(copy.clone()))
}))
@@ -1487,7 +1487,7 @@ fn swatch(theme: &Theme, p: &Palette, chosen: bool, showing: bool) -> gpui::Stat
div()
.h(px(78.))
.flex()
- .rounded(px(10.))
+ .rounded(crate::ui::kit::corner(10.))
.overflow_hidden()
.border_2()
.border_color(if chosen { theme.accent } else { theme.border_variant })
@@ -1502,7 +1502,7 @@ fn swatch(theme: &Theme, p: &Palette, chosen: bool, showing: bool) -> gpui::Stat
.gap(px(5.))
.px(px(6.))
.pt(px(10.))
- .child(div().size(px(10.)).rounded(px(3.)).bg(t.accent))
+ .child(div().size(px(10.)).rounded(crate::ui::kit::corner(3.)).bg(t.accent))
.child(bar(20., t.text_placeholder.opacity(0.7)))
.child(bar(16., t.text_placeholder.opacity(0.5)))
.child(bar(18., t.text_placeholder.opacity(0.5))),
@@ -1519,7 +1519,7 @@ fn swatch(theme: &Theme, p: &Palette, chosen: bool, showing: bool) -> gpui::Stat
.child(
div()
.h(px(30.))
- .rounded(px(6.))
+ .rounded(crate::ui::kit::corner(6.))
.bg(t.surface)
.border_1()
.border_color(t.border_variant)
@@ -1529,7 +1529,7 @@ fn swatch(theme: &Theme, p: &Palette, chosen: bool, showing: bool) -> gpui::Stat
.gap(px(4.))
.px(px(7.))
.child(bar(46., t.text.opacity(0.85)))
- .child(div().flex().gap(px(3.)).child(div().size(px(6.)).rounded(px(1.5)).bg(t.accent)).child(div().size(px(6.)).rounded(px(1.5)).bg(t.success)).child(div().size(px(6.)).rounded(px(1.5)).bg(t.success)).child(div().size(px(6.)).rounded(px(1.5)).border_1().border_color(t.text_placeholder))),
+ .child(div().flex().gap(px(3.)).child(div().size(px(6.)).rounded(crate::ui::kit::corner(1.5)).bg(t.accent)).child(div().size(px(6.)).rounded(crate::ui::kit::corner(1.5)).bg(t.success)).child(div().size(px(6.)).rounded(crate::ui::kit::corner(1.5)).bg(t.success)).child(div().size(px(6.)).rounded(crate::ui::kit::corner(1.5)).border_1().border_color(t.text_placeholder))),
)
.child(
div()
@@ -1540,7 +1540,7 @@ fn swatch(theme: &Theme, p: &Palette, chosen: bool, showing: bool) -> gpui::Stat
.child(div().size(px(6.)).rounded_full().bg(t.error))
.child(div().size(px(6.)).rounded_full().bg(t.info))
.child(div().flex_1())
- .child(div().w(px(24.)).h(px(9.)).rounded(px(3.)).bg(t.accent)),
+ .child(div().w(px(24.)).h(px(9.)).rounded(crate::ui::kit::corner(3.)).bg(t.accent)),
),
),
)
diff --git a/src/ui/settings/cloud.rs b/src/ui/settings/cloud.rs
index 2082338..3b4f244 100644
--- a/src/ui/settings/cloud.rs
+++ b/src/ui/settings/cloud.rs
@@ -393,7 +393,7 @@ impl SettingsPage {
.gap(px(10.))
.px(px(10.))
.h(px(30.))
- .rounded(px(6.))
+ .rounded(crate::ui::kit::corner(6.))
.cursor_pointer()
.border_1()
.border_color(if selected { theme.accent } else { theme.border_variant })
@@ -544,7 +544,7 @@ fn chip(theme: &Theme, id: SharedString, text: String, selected: bool) -> gpui::
.px(px(9.))
.flex()
.items_center()
- .rounded(px(6.))
+ .rounded(crate::ui::kit::corner(6.))
.border_1()
.cursor_pointer()
.text_size(px(12.5))
@@ -574,16 +574,16 @@ fn segmented(
.px(px(11.))
.flex()
.items_center()
- .rounded(px(6.))
+ .rounded(crate::ui::kit::corner(6.))
.cursor_pointer()
.text_size(px(12.5))
.text_color(if on { theme.text } else { theme.text_muted })
- .when(on, |d| d.bg(theme.surface).border_1().border_color(theme.border).shadow_sm())
+ .when(on, |d| d.bg(theme.surface).border_1().border_color(theme.border).when(!crate::ui::kit::square(), |d| d.shadow_sm()))
.when(!on, |d| d.hover(|st| st.text_color(theme.text)))
.child(*label)
.on_click(cx.listener(move |this, _, _, cx| pick(this, value, cx)))
.into_any_element()
})
.collect();
- div().flex().gap(px(2.)).p(px(3.)).rounded(px(8.)).bg(theme.element).border_1().border_color(theme.border_variant).children(items).into_any_element()
+ div().flex().gap(px(2.)).p(px(3.)).rounded(crate::ui::kit::corner(8.)).bg(theme.element).border_1().border_color(theme.border_variant).children(items).into_any_element()
}
diff --git a/src/ui/share.rs b/src/ui/share.rs
index 88132b9..ef06337 100644
--- a/src/ui/share.rs
+++ b/src/ui/share.rs
@@ -61,7 +61,7 @@ fn choice(theme: &Theme, id: (&'static str, usize), label: &'static str, picked:
.h(px(26.))
.flex()
.items_center()
- .rounded(px(6.))
+ .rounded(crate::ui::kit::corner(6.))
.border_1()
.text_size(px(12.))
.when(enabled, |d| d.cursor_pointer())
@@ -79,7 +79,7 @@ fn off_checkbox(theme: &Theme, label: &'static str) -> AnyElement {
.gap(px(8.))
.text_size(px(12.5))
.text_color(theme.text_placeholder)
- .child(div().size(px(15.)).rounded(px(4.)).border_1().border_color(theme.border_variant))
+ .child(div().size(px(15.)).rounded(crate::ui::kit::corner(4.)).border_1().border_color(theme.border_variant))
.child(label)
.into_any_element()
}
@@ -314,7 +314,7 @@ impl ShareDialog {
.gap(px(8.))
.p(px(6.))
.pl(px(12.))
- .rounded(px(9.))
+ .rounded(crate::ui::kit::corner(9.))
.border_1()
.border_color(theme.border)
.bg(theme.surface)
@@ -653,7 +653,7 @@ impl Render for JoinDialog {
.items_center()
.gap(px(4.))
.p(px(16.))
- .rounded(px(10.))
+ .rounded(crate::ui::kit::corner(10.))
.bg(theme.surface)
.border_1()
.border_color(theme.border)
@@ -871,11 +871,11 @@ impl Root {
.items_center()
.gap(px(14.))
.p(px(14.))
- .rounded(px(10.))
+ .rounded(crate::ui::kit::corner(10.))
.border_1()
.border_color(theme.accent)
.bg(theme.elevated)
- .shadow_lg()
+ .when(!crate::ui::kit::square(), |d| d.shadow_lg())
.child(
div()
.size(px(36.))
@@ -1557,7 +1557,7 @@ impl Root {
.h(px(44.))
.mx(px(10.))
.px(px(8.))
- .rounded(px(9.))
+ .rounded(crate::ui::kit::corner(9.))
.cursor_pointer()
.when(selected, |d| d.bg(theme.element_selected))
.when(!selected, |d| d.hover(|st| st.bg(theme.ghost_hover)))
@@ -1593,7 +1593,7 @@ impl Root {
.id(SharedString::from(format!("side-j-toggle-{}", j.id)))
.flex_none()
.p(px(3.))
- .rounded(px(5.))
+ .rounded(crate::ui::kit::corner(5.))
.invisible()
.group_hover("joined-row", |st| st.visible())
.hover(|st| st.bg(theme.ghost_hover))
@@ -1777,7 +1777,7 @@ fn nested_row(theme: &Theme, id: SharedString, selected: bool) -> gpui::Stateful
.mx(px(10.))
.pl(px(22.))
.pr(px(8.))
- .rounded(px(7.))
+ .rounded(crate::ui::kit::corner(7.))
.cursor_pointer()
.when(selected, |d| d.bg(theme.element_selected))
.when(!selected, |d| d.hover(|st| st.bg(theme.ghost_hover)))
diff --git a/src/ui/theme.rs b/src/ui/theme.rs
index 0aac64b..bd401ad 100644
--- a/src/ui/theme.rs
+++ b/src/ui/theme.rs
@@ -31,6 +31,8 @@ pub struct Theme {
pub id: &'static str,
/// Use the platform's own UI and monospace fonts (the macOS themes).
pub system_fonts: bool,
+ /// Looks like a TUI: the monospace font for everything, square, flat (see kit::square).
+ pub tui: bool,
/// The sidebar, which runs the full height of the window.
pub sidebar: Hsla,
/// The main content background.
@@ -229,6 +231,8 @@ pub fn apply(window: &Window, cx: &mut App) {
["SF Mono", "Menlo"].into_iter().find(|f| names.iter().any(|n| n == f)).unwrap_or(MONO_FONT)
});
(".SystemUIFont", mono)
+ } else if theme.tui {
+ (MONO_FONT, MONO_FONT)
} else {
(UI_FONT, MONO_FONT)
};
diff --git a/src/ui/themes.rs b/src/ui/themes.rs
index c6753fc..cc0a96c 100644
--- a/src/ui/themes.rs
+++ b/src/ui/themes.rs
@@ -30,6 +30,11 @@ pub struct Palette {
pub warning: u32,
pub error: u32,
pub info: u32,
+ /// Looks like a TUI in a terminal: one monospace font, square corners, no
+ /// shadows or gradients, `[ Buttons ]` and `── Headings ──` (see kit::square).
+ pub tui: bool,
+ /// A selected row's color, a solid bar (0: the accent, faintly, as usual).
+ pub bar: u32,
}
macro_rules! palette {
@@ -58,6 +63,27 @@ macro_rules! palette {
warning: $warning,
error: $error,
info: $info,
+ tui: false,
+ bar: 0,
+ }
+ };
+}
+
+/// A TUI look's palette: its selection bar a solid color, one accent, no gradient.
+macro_rules! tui {
+ ($id:literal, $name:literal, $dark:literal, bar $bar:literal,
+ sidebar $sidebar:literal, canvas $canvas:literal, surface $surface:literal, elevated $elevated:literal,
+ border $border:literal, $border_variant:literal,
+ text $text:literal, $muted:literal, $placeholder:literal,
+ accent $accent:literal, success $success:literal, warning $warning:literal, error $error:literal, info $info:literal) => {
+ Palette {
+ tui: true,
+ bar: $bar,
+ ..palette!($id, $name, $dark,
+ sidebar $sidebar, canvas $canvas, surface $surface, elevated $elevated,
+ border $border, $border_variant,
+ text $text, $muted, $placeholder,
+ accent $accent, success $success, warning $warning, error $error, info $info)
}
};
}
@@ -102,6 +128,8 @@ pub static PALETTES: &[Palette] = &[
warning: 0xff9f0a,
error: 0xff453a,
info: 0x40c8e0,
+ tui: false,
+ bar: 0,
},
palette!("gruvbox-dark", "Gruvbox Dark", true,
sidebar 0x1d2021, canvas 0x282828, surface 0x32302f, elevated 0x3c3836, border 0x504945, 0x3c3836,
@@ -147,6 +175,17 @@ pub static PALETTES: &[Palette] = &[
sidebar 0x16161d, canvas 0x1f1f28, surface 0x2a2a37, elevated 0x363646, border 0x54546d, 0x363646,
text 0xdcd7ba, 0xc8c093, 0x727169,
accent 0x7e9cd8, success 0x98bb6c, warning 0xe6c384, error 0xe46876, info 0x7fb4ca),
+ // Muxin as a TUI: a black terminal with a green accent and a deep blue
+ // selection bar, and Midnight Commander's navy with cyan lines. A bar is
+ // a deep tone, so a selected row's icons and grey text still read on it.
+ tui!("terminal", "Terminal", true, bar 0x1e3a52,
+ sidebar 0x111111, canvas 0x0c0c0c, surface 0x141414, elevated 0x1a1a1a, border 0x3a3a3a, 0x262626,
+ text 0xd0d0d0, 0x9a9a9a, 0x707070,
+ accent 0x5fd75f, success 0x00af87, warning 0xd7af5f, error 0xff5f5f, info 0x5fafd7),
+ tui!("terminal-midnight", "Terminal Midnight", true, bar 0x123f5e,
+ sidebar 0x0a1630, canvas 0x0b1a36, surface 0x0e2042, elevated 0x12274e, border 0x2f6fa8, 0x1d3f6e,
+ text 0xdfe7f5, 0x9fb3d4, 0x647aa0,
+ accent 0xffd75f, success 0x5fd787, warning 0xffaf5f, error 0xff6f6f, info 0x5fd7ff),
palette!("github-dark", "GitHub Dark", true,
sidebar 0x010409, canvas 0x0d1117, surface 0x161b22, elevated 0x1c2128, border 0x30363d, 0x21262d,
text 0xe6edf3, 0x9198a1, 0x6e7681,
@@ -186,6 +225,8 @@ pub static PALETTES: &[Palette] = &[
warning: 0xff9500,
error: 0xff3b30,
info: 0x30b0c7,
+ tui: false,
+ bar: 0,
},
palette!("gruvbox-light", "Gruvbox Light", false,
sidebar 0xf2e5bc, canvas 0xfbf1c7, surface 0xf9f5d7, elevated 0xf9f5d7, border 0xd5c4a1, 0xebdbb2,
@@ -223,6 +264,11 @@ pub static PALETTES: &[Palette] = &[
sidebar 0xf6f8fa, canvas 0xffffff, surface 0xffffff, elevated 0xffffff, border 0xd0d7de, 0xd8dee4,
text 0x1f2328, 0x59636e, 0x818b98,
accent 0x0969da, success 0x1a7f37, warning 0x9a6700, error 0xd1242f, info 0x0969da),
+ // Muxin as a TUI in a light terminal: black on off-white, a yellow selection bar.
+ tui!("terminal-paper", "Terminal Paper", false, bar 0xffd75f,
+ sidebar 0xefeee5, canvas 0xf7f6ef, surface 0xfbfaf4, elevated 0xffffff, border 0xb9b8ad, 0xd6d5ca,
+ text 0x1c1c1c, 0x55554d, 0x8e8e84,
+ accent 0x005fd7, success 0x2e7d32, warning 0x9a6700, error 0xc62828, info 0x005f87),
];
pub fn find(id: &str) -> Option<&'static Palette> {
@@ -249,6 +295,7 @@ impl Palette {
Theme {
id: self.id,
system_fonts: self.system_fonts,
+ tui: self.tui,
sidebar: color(self.sidebar),
canvas: color(self.canvas),
surface: color(self.surface),
@@ -258,7 +305,7 @@ impl Palette {
border_focused: accent,
element: text.opacity(if dark { 0.05 } else { 0.035 }),
element_hover: text.opacity(if dark { 0.09 } else { 0.065 }),
- element_selected: accent.opacity(if dark { 0.18 } else { 0.13 }),
+ element_selected: if self.bar != 0 { color(self.bar) } else { accent.opacity(if dark { 0.18 } else { 0.13 }) },
ghost_hover: text.opacity(if dark { 0.06 } else { 0.05 }),
text,
text_muted: color(self.text_muted),
@@ -282,6 +329,30 @@ impl Palette {
mod tests {
use super::*;
+ /// WCAG's contrast ratio between two colors.
+ fn contrast(a: u32, b: u32) -> f32 {
+ let (la, lb) = (luminance_wcag(a), luminance_wcag(b));
+ (la.max(lb) + 0.05) / (la.min(lb) + 0.05)
+ }
+
+ fn luminance_wcag(hex: u32) -> f32 {
+ let f = |c: u32| {
+ let c = c as f32 / 255.;
+ if c <= 0.03928 { c / 12.92 } else { ((c + 0.055) / 1.055).powf(2.4) }
+ };
+ 0.2126 * f(hex >> 16 & 0xff) + 0.7152 * f(hex >> 8 & 0xff) + 0.0722 * f(hex & 0xff)
+ }
+
+ #[test]
+ fn a_selection_bar_leaves_a_rows_text_and_icons_readable() {
+ for p in PALETTES.iter().filter(|p| p.bar != 0) {
+ assert!(contrast(p.text, p.bar) >= 4.5, "{}: text on its bar", p.id);
+ // Icons and secondary text are drawn muted; the faintest grey stays visible.
+ assert!(contrast(p.text_muted, p.bar) >= 4.0, "{}: muted on its bar", p.id);
+ assert!(contrast(p.text_placeholder, p.bar) >= 2.2, "{}: faint text on its bar", p.id);
+ }
+ }
+
#[test]
fn ids_are_unique_and_defaults_exist() {
let mut ids: Vec<_> = PALETTES.iter().map(|p| p.id).collect();
diff --git a/src/ui/usage.rs b/src/ui/usage.rs
index 571c0f0..a7a6032 100644
--- a/src/ui/usage.rs
+++ b/src/ui/usage.rs
@@ -97,7 +97,7 @@ impl Root {
.flex()
.items_center()
.gap(px(8.))
- .child(div().flex().gap(px(2.)).p(px(2.)).rounded(px(7.)).bg(theme.element).children(PERIODS.iter().map(|&(label, days)| {
+ .child(div().flex().gap(px(2.)).p(px(2.)).rounded(crate::ui::kit::corner(7.)).bg(theme.element).children(PERIODS.iter().map(|&(label, days)| {
let on = self.usage_days == days;
div()
.id(SharedString::from(format!("usage-{days}")))
@@ -105,7 +105,7 @@ impl Root {
.h(px(24.))
.flex()
.items_center()
- .rounded(px(5.))
+ .rounded(crate::ui::kit::corner(5.))
.cursor_pointer()
.text_size(px(12.))
.text_color(if on { theme.text } else { theme.text_placeholder })
@@ -226,11 +226,11 @@ impl Root {
.flex_col()
.justify_end()
.tooltip(move |window, cx| kit::Tooltip::view(tip.clone().into(), window, cx))
- .child(div().w_full().h(relative((x / peak) as f32)).bg(codex_color).rounded_t(px(2.)))
- .child(div().w_full().h(relative((c / peak) as f32)).bg(claude_color).when(x == 0., |d| d.rounded_t(px(2.))))
- .when(c + x == 0., |d| d.child(div().w_full().h(px(2.)).rounded(px(1.)).bg(theme.track)))
+ .child(div().w_full().h(relative((x / peak) as f32)).bg(codex_color).rounded_t(crate::ui::kit::corner(2.)))
+ .child(div().w_full().h(relative((c / peak) as f32)).bg(claude_color).when(x == 0., |d| d.rounded_t(crate::ui::kit::corner(2.))))
+ .when(c + x == 0., |d| d.child(div().w_full().h(px(2.)).rounded(crate::ui::kit::corner(1.)).bg(theme.track)))
}));
- let legend = |color: gpui::Rgba, text: &'static str| div().flex().items_center().gap(px(6.)).child(div().size(px(8.)).rounded(px(2.)).bg(color)).child(text);
+ let legend = |color: gpui::Rgba, text: &'static str| div().flex().items_center().gap(px(6.)).child(div().size(px(8.)).rounded(crate::ui::kit::corner(2.)).bg(color)).child(text);
body = body.child(
card(&theme)
.p(px(16.))
diff --git a/src/ui/vm_dialog.rs b/src/ui/vm_dialog.rs
index 58d5ec6..31d8220 100644
--- a/src/ui/vm_dialog.rs
+++ b/src/ui/vm_dialog.rs
@@ -141,7 +141,7 @@ impl Render for VmDialog {
.px(px(9.))
.flex()
.items_center()
- .rounded(px(6.))
+ .rounded(crate::ui::kit::corner(6.))
.border_1()
.text_size(px(12.5))
.when(enabled, |d| d.cursor_pointer())
diff --git a/src/ui/workspaces.rs b/src/ui/workspaces.rs
index ddcd4c4..fdb46b4 100644
--- a/src/ui/workspaces.rs
+++ b/src/ui/workspaces.rs
@@ -78,7 +78,7 @@ impl Root {
.flex_col()
.gap(px(12.))
.p(px(16.))
- .rounded(px(12.))
+ .rounded(crate::ui::kit::corner(12.))
.border_1()
.border_color(theme.border_variant)
.bg(theme.surface)
@@ -142,7 +142,7 @@ impl Root {
.gap(px(10.))
.px(px(10.))
.py(px(7.))
- .rounded(px(8.))
+ .rounded(crate::ui::kit::corner(8.))
.bg(theme.accent2.opacity(0.10))
.text_size(px(12.5))
.child(icon("git-merge", 14., theme.accent2))
@@ -159,7 +159,7 @@ impl Root {
.gap(px(10.))
.px(px(10.))
.py(px(7.))
- .rounded(px(8.))
+ .rounded(crate::ui::kit::corner(8.))
.bg(theme.sidebar)
.font_family(mono_font())
.text_size(px(12.))
@@ -421,7 +421,7 @@ impl Root {
.mx(px(14.))
.mb(px(10.))
.p(px(10.))
- .rounded(px(8.))
+ .rounded(crate::ui::kit::corner(8.))
.bg(theme.sidebar)
.font_family(mono_font())
.text_size(px(11.5))
@@ -624,7 +624,7 @@ fn exit_badge(theme: &Theme, c: &WorkspaceCommand) -> AnyElement {
.flex()
.items_center()
.justify_center()
- .rounded(px(4.))
+ .rounded(crate::ui::kit::corner(4.))
.bg(color.opacity(0.14))
.text_color(color)
.font_family(mono_font())