A modern terminal with a built-in multiplexer: close it and your sessions keep running. Run shells and tons of AI agents across your machines, then pick them up from desktop, browser, TUI and more. Written in Rust with no UI framework: interface drawn straight on the GPU. No Electron, GPUI or webview.
Rust agentagent-orchestrationaiai-agentsclaude-codecodexcoding-agentlinuxmacosmultiplayermultiplexerrustterminalterminal-emulatorterminal-multiplexertmuxtuiweztermwindows
feat(ui): add a group background token and gradient rounded rects
RoversXed5a296466b9
diff --git a/config/src/color.rs b/config/src/color.rsindex 6246d5eb..84cf09cf 100644--- a/config/src/color.rs+++ b/config/src/color.rs@@ -449,6 +449,10 @@ pub struct UiColors {#[dynamic(default)]pub card_bg: Option<RgbaColor>,+ /// A group of rows inside a card.+ #[dynamic(default)]+ pub group_bg: Option<RgbaColor>,+/// Primary text.#[dynamic(default)]pub text: Option<RgbaColor>,diff --git a/docs/thinkterm/ui-colors.md b/docs/thinkterm/ui-colors.mdindex f6d12fe3..3e9601ee 100644--- a/docs/thinkterm/ui-colors.md+++ b/docs/thinkterm/ui-colors.md@@ -77,7 +77,7 @@ for every other option.**Surfaces** -- `window_bg` (the ground behind everything), `sidebar_bg`,`workspace_sidebar_bg` (the Spaces strip, recessed from the sidebar),`header_bg` (the strip above the tabs), `card_bg` (a grouped card floating on-`window_bg`).+`window_bg`), `group_bg` (a group of rows inside a card).**Controls** -- `control_bg` at rest, `control_hover_bg` under the pointer,`control_pressed_bg` while held, `control_border` for the hairline outline,diff --git a/wezterm-gui/src/native_settings.rs b/wezterm-gui/src/native_settings.rsindex 56d7b541..80b992d9 100644--- a/wezterm-gui/src/native_settings.rs+++ b/wezterm-gui/src/native_settings.rs@@ -1181,6 +1181,7 @@ pub(crate) fn apply_ui_colors(apply_color!(danger);apply_color!(track_off);apply_color!(card_bg);+ apply_color!(group_bg);apply_color!(text);apply_color!(secondary_text);apply_color!(muted_text);diff --git a/wezterm-gui/src/ui/draw.rs b/wezterm-gui/src/ui/draw.rsindex 70cab771..a8004dd6 100644--- a/wezterm-gui/src/ui/draw.rs+++ b/wezterm-gui/src/ui/draw.rs@@ -27,6 +27,7 @@ use crate::utilsprites::RenderMetrics;use std::rc::Rc;use wezterm_bidi::Direction;use wezterm_font::LoadedFont;+use window::bitmaps::TextureRect;use window::color::LinearRgba;use window::{Dimensions, RectF};@@ -504,6 +505,95 @@ impl<'a> DrawContext<'a> {Ok(())}+ /// A rounded rectangle filled from `top` at its top edge to `bottom` at+ /// its bottom one. It is drawn in the same pieces as `draw_rounded_rect`;+ /// each piece takes the colours of the rows it spans, so the GPU's+ /// interpolation joins them into one ramp.+ #[allow(clippy::too_many_arguments)]+ pub(crate) fn draw_rounded_rect_vertical_gradient(+ &self,+ layers: &mut TripleLayerQuadAllocator<'_>,+ layer_num: usize,+ rect: RectF,+ radius: f32,+ top: LinearRgba,+ bottom: LinearRgba,+ ) -> anyhow::Result<()> {+ let Some(PixelSnappedRoundedRect {+ x,+ y,+ width,+ height,+ radius,+ }) = pixel_snap_rounded_rect(+ rect.origin.x,+ rect.origin.y,+ rect.size.width,+ rect.size.height,+ radius,+ )+ else {+ return Ok(());+ };+ let at = |row: f32| {+ let t = ((row - y) / height).clamp(0.0, 1.0);+ LinearRgba::with_components(+ top.0 + (bottom.0 - top.0) * t,+ top.1 + (bottom.1 - top.1) * t,+ top.2 + (bottom.2 - top.2) * t,+ top.3 + (bottom.3 - top.3) * t,+ )+ };++ let lower = y + height - radius;+ if radius > 0.0 {+ let size = euclid::size2(radius, radius);+ let left_offset = self.dimensions.pixel_width as f32 / 2.0;+ let top_offset = self.dimensions.pixel_height as f32 / 2.0;+ for (polys, corner_x, corner_y) in [+ (TOP_LEFT_ROUNDED_CORNER, x, y),+ (TOP_RIGHT_ROUNDED_CORNER, x + width - radius, y),+ (BOTTOM_LEFT_ROUNDED_CORNER, x, lower),+ (BOTTOM_RIGHT_ROUNDED_CORNER, x + width - radius, lower),+ ] {+ let sprite = self.corner_sprite(polys, size)?;+ let mut quad = layers.allocate(layer_num)?;+ quad.set_position(+ corner_x - left_offset,+ corner_y - top_offset,+ corner_x + radius - left_offset,+ corner_y + radius - top_offset,+ );+ quad.set_texture(sprite);+ quad.set_vertical_gradient(at(corner_y), at(corner_y + radius));+ quad.set_alt_color_and_mix_value(at(corner_y), 0.0);+ quad.set_hsv(None);+ quad.set_has_color(false);+ quad.set_grayscale();+ }+ }++ // The column between the corners runs the full height; the bands+ // beside it only between them. Empty ones draw nothing.+ self.draw_vertical_gradient(+ layers,+ layer_num,+ euclid::rect(x + radius, y, width - radius * 2.0, height),+ top,+ bottom,+ )?;+ for band_x in [x, x + width - radius] {+ self.draw_vertical_gradient(+ layers,+ layer_num,+ euclid::rect(band_x, y + radius, radius, lower - (y + radius)),+ at(y + radius),+ at(lower),+ )?;+ }+ Ok(())+ }+/// A grouped card: the translucent surface a panel's contents sit on./// One call, so every page groups things the same way.pub(crate) fn draw_card(@@ -554,19 +644,7 @@ impl<'a> DrawContext<'a> {size: euclid::Size2D<f32, window::PixelUnit>,color: LinearRgba,) -> anyhow::Result<()> {- let render_state = self.render_state;- let sprite = render_state- .glyph_cache- .borrow_mut()- .cached_block(- BlockKey::PolyWithCustomMetrics {- polys,- underline_height: self.metrics.underline_height,- cell_size: euclid::size2(size.width as isize, size.height as isize),- },- self.metrics,- )?- .texture_coords();+ let sprite = self.corner_sprite(polys, size)?;let mut quad = layers.allocate(layer_num)?;let left_offset = self.dimensions.pixel_width as f32 / 2.0;@@ -586,6 +664,27 @@ impl<'a> DrawContext<'a> {Ok(())}+ /// A rounded corner's coverage in the atlas, `size` pixels square.+ fn corner_sprite(+ &self,+ polys: &'static [Poly],+ size: euclid::Size2D<f32, window::PixelUnit>,+ ) -> anyhow::Result<TextureRect> {+ Ok(self+ .render_state+ .glyph_cache+ .borrow_mut()+ .cached_block(+ BlockKey::PolyWithCustomMetrics {+ polys,+ underline_height: self.metrics.underline_height,+ cell_size: euclid::size2(size.width as isize, size.height as isize),+ },+ self.metrics,+ )?+ .texture_coords())+ }+pub(crate) fn draw_svg_icon(&self,layers: &mut TripleLayerQuadAllocator<'_>,diff --git a/wezterm-gui/src/ui/tokens.rs b/wezterm-gui/src/ui/tokens.rsindex 561eb7dd..2027e3b9 100644--- a/wezterm-gui/src/ui/tokens.rs+++ b/wezterm-gui/src/ui/tokens.rs@@ -43,6 +43,11 @@ pub(crate) struct UiPalette {/// Fill for a grouped card floating on `window_bg`. Translucent on/// purpose: it picks up whatever the page paints behind it.pub card_bg: LinearRgba,+ /// Fill for a group of rows inside a card, the way System Settings+ /// groups them: a step off `card_bg`, below `control_bg` so the+ /// controls in the rows still stand out. A concrete colour, for the+ /// reason the sidebar row ramp gives.+ pub group_bg: LinearRgba,pub text: LinearRgba,pub secondary_text: LinearRgba,pub muted_text: LinearRgba,@@ -68,7 +73,7 @@ pub(crate) struct UiPalette {/// moves them cannot disagree. The accent family and the text slots are/// deliberately absent: accents are kept as designed, and text is moved and/// then held to a contrast floor, which is a different rule.-const SURFACE_SLOTS: [fn(&mut UiPalette) -> &mut LinearRgba; 18] = [+const SURFACE_SLOTS: [fn(&mut UiPalette) -> &mut LinearRgba; 19] = [|p| &mut p.window_bg,|p| &mut p.sidebar_bg,|p| &mut p.workspace_sidebar_bg,@@ -86,6 +91,7 @@ const SURFACE_SLOTS: [fn(&mut UiPalette) -> &mut LinearRgba; 18] = [|p| &mut p.sidebar_row_active_border,|p| &mut p.track_off,|p| &mut p.card_bg,+ |p| &mut p.group_bg,|p| &mut p.scrollbar_thumb,];@@ -314,6 +320,7 @@ impl UiPalette {danger: rgb(215, 38, 61),track_off: rgba(220, 220, 226, 1.0),card_bg: rgba(255, 255, 255, 0.72),+ group_bg: rgb(242, 242, 245),text: rgb(28, 28, 30),secondary_text: rgb(72, 72, 74),muted_text: rgb(142, 142, 147),@@ -346,6 +353,7 @@ impl UiPalette {danger: rgb(255, 69, 58),track_off: rgba(78, 78, 82, 1.0),card_bg: rgba(30, 30, 32, 0.78),+ group_bg: rgb(37, 37, 39),text: rgb(242, 242, 247),secondary_text: rgb(199, 199, 204),muted_text: rgb(142, 142, 147),