From 4cede42748e3ddfce5b9e77fe97958c5d433a907 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Wed, 9 Feb 2022 15:08:01 +0100 Subject: [PATCH] Add ui.weak(text) --- CHANGELOG.md | 7 ++++--- egui/src/ui.rs | 7 +++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e2a583b0..1c38a1dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,7 +21,8 @@ NOTE: [`epaint`](epaint/CHANGELOG.md), [`eframe`](eframe/CHANGELOG.md), [`egui_w * Added `ui.data()`, `ctx.data()`, `ctx.options()` and `ctx.tessellation_options()` ([#1175](https://github.com/emilk/egui/pull/1175)). * Added `Plot::allow_boxed_zoom()`, `Plot::boxed_zoom_pointer()` for boxed zooming on plots ([#1188](https://github.com/emilk/egui/pull/1188)). * Added linked axis support for plots via `plot::LinkedAxisGroup` ([#1184](https://github.com/emilk/egui/pull/1184)). -* Added `Response::on_hover_text_at_pointer` as a convenience akin to `Response::on_hover_text`. ([1179](https://github.com/emilk/egui/pull/1179)) +* Added `Response::on_hover_text_at_pointer` as a convenience akin to `Response::on_hover_text` ([1179](https://github.com/emilk/egui/pull/1179)). +* Added `ui.weak(text)`. ### Changed 🔧 * ⚠️ `Context::input` and `Ui::input` now locks a mutex. This can lead to a dead-lock is used in an `if let` binding! @@ -44,8 +45,8 @@ NOTE: [`epaint`](epaint/CHANGELOG.md), [`eframe`](eframe/CHANGELOG.md), [`egui_w * `ScrollArea::show` now returns a `ScrollAreaOutput`, so you might need to add `.inner` after the call to it ([#1166](https://github.com/emilk/egui/pull/1166)). ### Fixed 🐛 -* Context menus now respects the theme ([#1043](https://github.com/emilk/egui/pull/1043)) -* Plot `Orientation` was not public, although fields using this type were ([#1130](https://github.com/emilk/egui/pull/1130)) +* Context menus now respects the theme ([#1043](https://github.com/emilk/egui/pull/1043)). +* Plot `Orientation` was not public, although fields using this type were ([#1130](https://github.com/emilk/egui/pull/1130)). * Fixed `enable_drag` for Windows ([#1108](https://github.com/emilk/egui/pull/1108)). * Calling `Context::set_pixels_per_point` before the first frame will now work. diff --git a/egui/src/ui.rs b/egui/src/ui.rs index b5a04c8f..b1790e8c 100644 --- a/egui/src/ui.rs +++ b/egui/src/ui.rs @@ -1158,6 +1158,13 @@ impl Ui { Label::new(text.into().strong()).ui(self) } + /// Show text that is waker (fainter color). + /// + /// Shortcut for `ui.label(RichText::new(text).weak())` + pub fn weak(&mut self, text: impl Into) -> Response { + Label::new(text.into().weak()).ui(self) + } + /// Shortcut for `add(Hyperlink::new(url))` /// /// See also [`Hyperlink`].