Skip to content

Add a toggle for the compact menu style#5777

Merged
lucasmerlin merged 1 commit intoemilk:masterfrom
s-nie:compact-menu-style-toggle
Mar 18, 2025
Merged

Add a toggle for the compact menu style#5777
lucasmerlin merged 1 commit intoemilk:masterfrom
s-nie:compact-menu-style-toggle

Conversation

@s-nie
Copy link
Contributor

@s-nie s-nie commented Mar 10, 2025

Menus currently have their own style that removes outlines and backgrounds. This is nice if the menu only contains buttons. However if the menu contains other widgets, e.g. a drag value, the style change makes it quite difficult to identify such widgets. This is a simple way to make this configurable.

  • I have followed the instructions in the PR template

@github-actions
Copy link

Preview available at https://egui-pr-preview.github.io/pr/5777-compact-menu-style-toggle
Note that it might take a couple seconds for the update to show up after the preview_build workflow has completed.

@s-nie s-nie marked this pull request as ready for review March 11, 2025 07:14
Copy link
Collaborator

@lucasmerlin lucasmerlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this makes sense, but I think it would be even better if users could globally customize the menu style to their liking. That would mean Style would have to hold a StyleModifier, is that weird? @emilk what do you think?
I think performance wise it would be fine, since StyleModifier is an Arc

@lucasmerlin lucasmerlin added egui style visuals and theming labels Mar 13, 2025
@s-nie
Copy link
Contributor Author

s-nie commented Mar 14, 2025

I think this makes sense, but I think it would be even better if users could globally customize the menu style to their liking. That would mean Style would have to hold a StyleModifier, is that weird? @emilk what do you think? I think performance wise it would be fine, since StyleModifier is an Arc

Sure, we could also make it more customizable. If StyleModifier held a function however, that would disqualify it from being serialized, similar to the NumberFormatter field.

Copy link
Collaborator

@lucasmerlin lucasmerlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@lucasmerlin lucasmerlin merged commit 024dc7b into emilk:master Mar 18, 2025
15 of 27 checks passed
darkwater pushed a commit to darkwater/egui that referenced this pull request Aug 24, 2025
<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/master/CONTRIBUTING.md)
before opening a Pull Request!

* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to test and add commits to your PR.
* Remember to run `cargo fmt` and `cargo clippy`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.

Please be patient! I will review your PR, but my time is limited!
-->

Menus currently have their own style that removes outlines and
backgrounds. This is nice if the menu only contains buttons. However if
the menu contains other widgets, e.g. a drag value, the style change
makes it quite difficult to identify such widgets. This is a simple way
to make this configurable.


* [x] I have followed the instructions in the PR template
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

egui style visuals and theming

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants