From 1f3e6386b2ea19a7e5e67ff21564c1cb953fa013 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Tue, 4 Aug 2026 14:20:07 +0200 Subject: [PATCH] Address review comments on the theme module * Rename `StyleProvider::theme_type_id` to `type_id` * Reword the `Ui::widget_style` docstring Co-Authored-By: Claude Opus 5 (1M context) --- crates/egui/src/theme/mod.rs | 5 ++--- crates/egui/src/theme/style_provider.rs | 4 ++-- crates/egui/src/theme/themes.rs | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/crates/egui/src/theme/mod.rs b/crates/egui/src/theme/mod.rs index bd7bc484d..59641acc4 100644 --- a/crates/egui/src/theme/mod.rs +++ b/crates/egui/src/theme/mod.rs @@ -12,9 +12,8 @@ use crate::{ }; impl Ui { - /// Access the register theme and fetch the requested [`WidgetStyle`]. - /// - /// Requested widget style must implement [`WidgetStyle`]. + /// The style of the widget with the given [`crate::Id`] and [`Classes`], + /// as computed by the registered theme. pub fn widget_style( &self, id: crate::Id, diff --git a/crates/egui/src/theme/style_provider.rs b/crates/egui/src/theme/style_provider.rs index 379da16c7..fd38902c7 100644 --- a/crates/egui/src/theme/style_provider.rs +++ b/crates/egui/src/theme/style_provider.rs @@ -7,8 +7,8 @@ pub trait StyleProvider { /// The style according to the classes and state of the widget fn style(&mut self, modifiers: &StyleArgs<'_>) -> S; - /// Help to differ the different themes - fn theme_type_id(&self) -> TypeId + /// Used to tell different themes apart + fn type_id(&self) -> TypeId where Self: 'static, { diff --git a/crates/egui/src/theme/themes.rs b/crates/egui/src/theme/themes.rs index fd91ba41b..e2e419b1b 100644 --- a/crates/egui/src/theme/themes.rs +++ b/crates/egui/src/theme/themes.rs @@ -73,7 +73,7 @@ impl Themes { && self .themes .get_temp::>(Id::NULL) - .is_some_and(|t| t.lock().theme_type_id() == theme.theme_type_id()) + .is_some_and(|t| t.lock().type_id() == theme.type_id()) { return; }