-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Make margin/padding/spacing changes optional #10
Comments
Hey, first off thanks for interest in the project and taking time to open an issue. You are absolutely right, I've been meaning to take some time and refactor the spacing, margin, padding and shadowing. I do like the idea of every theme keeping the default egui styles (except for the colors) out of the box. But there needs to be an easy way for the user to inject styles. I feel like, Step 1 could be, refactoring the Aesthetix trait to have default egui styles which would propagate to what ever theme implements the trait. Clean up the color schemes, then do a release. Step 2 could be, implement an easy way for styles, padding, etc to be injected into each Theme, maybe supply some prebuilt custom styles that would match the Gnome desktops GUI style (just an example) what do you think? |
Hiya, I had the same issue and implemented an adapter that restores the normal spacing (as mentioned in the trait): struct AesthetixWithNormalSpacing<A: egui_aesthetix::Aesthetix>(A);
impl<A: egui_aesthetix::Aesthetix> egui_aesthetix::Aesthetix for AesthetixWithNormalSpacing<A> {
fn name(&self) -> &str {
self.0.name()
}
fn primary_accent_color_visuals(&self) -> egui::Color32 {
self.0.primary_accent_color_visuals()
}
fn secondary_accent_color_visuals(&self) -> egui::Color32 {
self.0.secondary_accent_color_visuals()
}
fn bg_primary_color_visuals(&self) -> egui::Color32 {
self.0.bg_primary_color_visuals()
}
fn bg_secondary_color_visuals(&self) -> egui::Color32 {
self.0.bg_secondary_color_visuals()
}
fn bg_triage_color_visuals(&self) -> egui::Color32 {
self.0.bg_triage_color_visuals()
}
fn bg_auxiliary_color_visuals(&self) -> egui::Color32 {
self.0.bg_auxiliary_color_visuals()
}
fn bg_contrast_color_visuals(&self) -> egui::Color32 {
self.0.bg_contrast_color_visuals()
}
fn fg_primary_text_color_visuals(&self) -> Option<egui::Color32> {
self.0.fg_primary_text_color_visuals()
}
fn fg_success_text_color_visuals(&self) -> egui::Color32 {
self.0.fg_success_text_color_visuals()
}
fn fg_warn_text_color_visuals(&self) -> egui::Color32 {
self.0.fg_warn_text_color_visuals()
}
fn fg_error_text_color_visuals(&self) -> egui::Color32 {
self.0.fg_error_text_color_visuals()
}
fn dark_mode_visuals(&self) -> bool {
self.0.dark_mode_visuals()
}
fn margin_style(&self) -> f32 {
6.0
}
fn button_padding(&self) -> egui::Vec2 {
egui::Vec2::new(6.0, 4.0)
}
fn item_spacing_style(&self) -> f32 {
4.0
}
fn scroll_bar_width_style(&self) -> f32 {
6.0
}
fn rounding_visuals(&self) -> f32 {
4.0
}
}
contexts.ctx_mut().set_style(Arc::new(
AesthetixWithNormalSpacing(egui_aesthetix::themes::NordDark).custom_style(),
)); A similar technique could be used to flip the default around, such that that standard EDIT: It might also be worth having |
Would it be possible to export variants of the themes which do not automatically bundle margin/padding/spacing changes which differ from the default egui theme along with the colorscheme values?
I am working on a status bar in egui and I was interested in using this crate to provide some nice out-of-the-box themes (and also hopefully get some more people contributing themes here?), but these bundled margin/padding/spacing changes can throw users' existing status bar layouts a little out of whack:
Without egui-aesthetix:
With egui-aesthetix:
The text was updated successfully, but these errors were encountered: