-
Notifications
You must be signed in to change notification settings - Fork 5
A clickable button that changes the theme to dark/light #94
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
base: main
Are you sure you want to change the base?
Conversation
Hello, thanks for working on this ! To save the theme across restart, you must add a field in the struct of Gupax in src/disk/state.rs and check it when the App is created at startup. In this case, don't forget to include it in the eframe_impl.rs file to get the button save/restore working correctly with it. Note: egui has a feature called "persistence" that isn't used in Gupaxx yet but that could maybe replace some logic in the future. Possibly some color will need to be tweaked for the light theme. Ex: at 7s in the video, the token field is unreadable because it is almost white on white. That could be part of this PR if you want to. Having the cc field as an option is really not an issue. I am hesitant between keeping the button on the bottom bar (it's good looking) and having the setting only in the Gupaxx tab since it won't be used very often by the user. We can keep it that way for now. |
Done, and a removed
It seems that this text type is hard-coded as a fixed color (BONE). I tried to remove it, but from some reason, just works in the first column, any ideas why?
I first put it there, then I changed it to this bar because I thought it looked more elegant and didn't take up much space. Please let me know if you’d like adjustments or additional tests! |
It is changing the color of the other columns when you remove .color(BONE) from the code. It's just that the other columns here are disabled since the corresponding service is not started. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes of the theme should not be saved unless the user click on the "Save" button, even if it's applied in the current session. You can look at the "hero mode" button of the XvB tab as an example. Beware there is a "Save on exit" option in Gupaxx tab.
One more thing, the default should not be dark, but be whatever the operating system prefer. |
This PR try to close issue #90.
Changes in #93
VISUALS_LIGHT
and renameVISUALS
toVISUALS_DARK
dark_mode
boolean inApp
struct.Changes in 2a1b1a9
egui::Context;
in a var inside theApp
struct, to be able to use later byctx.set_visuals(visuals);
cc: Option<Context>
insideApp
.Using
Option<egui::Context>
works but isn’t ideal.simplescreenrecorder-2025-05-08_20.17.15.mp4
We initialize it to
None
in the constructor and assign it later inpub fn cc
. Currently, the theme resets on app restart. If desired, we can extend this by savingdark_mode
Please let me know if you’d like adjustments or additional tests!