-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Changed ui.disable()
to modify opacity.
#6765
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
Conversation
It previously tinted elements, which could have lackluster effects.
This has far-reaching consequences for the visual of existing egui apps other than just fixing the linked issue. I think this change should be configurable; otherwise, significant considerations should be put into messing up existing visuals. |
That's a fair viewpoint. What other possible solutions to this issue do you recommend? I tried modifying the Relevant method: Lines 1055 to 1060 in 5d6aaa2
Out of interest in which situations will this be an issue for (so I could potentially work on solving them)? |
The problem is exactly what you mentioned in the I believe that a method of fading out (color or transparency) should be an option in the style. Maybe as an enum variant akin to
the exact shape of variants and naming should be discussed ofc |
I agree with being able to override the fade out colour, but that does lean towards a more major change, as Also adding more default colours increases the maintenance burden in the future. i'm not sure if that would be needed if the user can customise the fade out colour. |
A possible option for setting a custom fade out colour would be to add a feild like |
Preview available at https://egui-pr-preview.github.io/pr/6765-defaultaffectsopacity |
"fade_out_to_color" was replaced by "fade_out_opacity" for this purpose.
Will it be a good idea to add an attribute to Because currently the value is hard-coded, so it cannot be changed. |
The fade amount for UI elements can be customised.
I have added the option for user-customization that i suggested & created a pull request against the branch in my fork for anyone to look at. I can easily merge these changes into the branch in this egui pull request. |
emilk, do you want me to merge the user-customisation code? |
Yes, adding a |
👍 I have done so. |
There is a problem with this approach: |
I will be able to work on this at the weekend |
Split these two behaviours into different functions, as either behaviour is sometimes desirable.
I've restored This allows for either to be used if modifying the alpha if undesirable. |
An issue with the modify opacity approach is that the "colour picker" widget does not look very good when disabled on light mode. Screencast_20250525_095916.webm |
Should i re-add the |
Yeah, why not. You also need to update the snapshot images (again), because of a merge race (sorry!) |
I think that you have to run the CI to generate the images again for me to pull them from the CI, apologies. |
This should do it! |
* Closes #6765 Branched off of #6765 by @tye-exe. I needed to branch off to update snapshot images --------- Co-authored-by: tye-exe <[email protected]> Co-authored-by: Tye <[email protected]>
It previously tinted elements, which could have lackluster effects.
New looks
(I say new but I tried to keep them as similar as possible to previous)
Light mode
light_mode.webm
Dark mode
dark_mode.webm
Additional remarks
Since the opacity is being change, elements that are on-top of other elements now show some of the underneath element (this can be seen with the slider in the sent videos).