diff --git a/crates/re_ui/src/lib.rs b/crates/re_ui/src/lib.rs index e245968d0e5e..448f2ece2800 100644 --- a/crates/re_ui/src/lib.rs +++ b/crates/re_ui/src/lib.rs @@ -57,6 +57,9 @@ pub enum LabelStyle { /// Label displaying the placeholder text for a yet unnamed item (e.g. an unnamed space view). Unnamed, + + /// Label for containers, which are subdued compared to space views to make them distinctive + Container, } // ---------------------------------------------------------------------------- @@ -925,7 +928,7 @@ impl ReUi { let mut text: egui::WidgetText = text.into(); match style { - LabelStyle::Normal => {} + LabelStyle::Normal | LabelStyle::Container => {} LabelStyle::Unnamed => { // TODO(ab): use design tokens text = text.italics(); @@ -991,6 +994,10 @@ impl ReUi { // TODO(ab): use design tokens text_color = text_color.gamma_multiply(0.5); } + LabelStyle::Container => { + // TODO(ab): use design tokens + text_color = ui.visuals().widgets.noninteractive.text_color(); + } } ui.painter() .galley_with_override_text_color(text_pos, galley, text_color); diff --git a/crates/re_ui/src/list_item.rs b/crates/re_ui/src/list_item.rs index 195d85b0baa5..217458c3235a 100644 --- a/crates/re_ui/src/list_item.rs +++ b/crates/re_ui/src/list_item.rs @@ -325,6 +325,11 @@ impl<'a> ListItem<'a> { LabelStyle::Unnamed => { self.italics = true; } + LabelStyle::Container => { + self.text = self + .text + .color(ui.visuals().widgets.noninteractive.text_color()); + } } if self.italics { @@ -455,7 +460,7 @@ impl<'a> ListItem<'a> { } match self.label_style { - LabelStyle::Normal => {} + LabelStyle::Normal | LabelStyle::Container => {} LabelStyle::Unnamed => { self.text = self.text.color(visuals.fg_stroke.color.gamma_multiply(0.5)); } diff --git a/crates/re_viewer/src/ui/selection_panel.rs b/crates/re_viewer/src/ui/selection_panel.rs index 2dab7fd84f5a..997037901947 100644 --- a/crates/re_viewer/src/ui/selection_panel.rs +++ b/crates/re_viewer/src/ui/selection_panel.rs @@ -675,6 +675,7 @@ fn show_list_item_for_container_child( ( Item::Container(child_tile_id), ListItem::new(ctx.re_ui, format!("{:?}", container.kind())) + .label_style(re_ui::LabelStyle::Container) .with_icon(icon_for_container_kind(&container.kind())), ) } diff --git a/crates/re_viewport/src/viewport_blueprint_ui.rs b/crates/re_viewport/src/viewport_blueprint_ui.rs index 4e1fccb0b154..27bb01a8fa43 100644 --- a/crates/re_viewport/src/viewport_blueprint_ui.rs +++ b/crates/re_viewport/src/viewport_blueprint_ui.rs @@ -112,6 +112,7 @@ impl Viewport<'_, '_> { let response = ListItem::new(ctx.re_ui, format!("{:?}", container.kind())) .subdued(!container_visible) .selected(ctx.selection().contains_item(&item)) + .label_style(re_ui::LabelStyle::Container) .with_icon(crate::icon_for_container_kind(&container.kind())) .with_buttons(|re_ui, ui| { let vis_response = visibility_button_ui(re_ui, ui, parent_visible, &mut visible);