Dvlv / BoxBuddyRS

A Graphical Interface for Distrobox
MIT License
251 stars 24 forks source link

Fix assemble icon for dark mode #51

Closed VortexAcherontic closed 8 months ago

VortexAcherontic commented 8 months ago

Hello there,

Since BoxBuddy uses a custom hammer icon for the distrobox assemble button it only comes with a dark variant.
This one does not line up with the dark mode of Gnome.

By this PR I introduced a util function is_dark_mode() which uses the Adwaita StyleManager to check if the desktop is running with a dark or a light theme.

In addition I provided a light version of the hammer icon which is then used for the button instead of the dark variant.

Edit: Forgot to mention this.
I also added:

    debug_assert!({
        return format!("icons/{}", icon);
    });

for the icon path for development environments.
This code is only executed if BoxBuddy is compiled without optimizations.
In order for developers not needing to uncomment the icon path for development purpose.
For further details I leave the link to the official documentation here

Kind regards, V.

VortexAcherontic commented 8 months ago

I just pushed a little addition.
The hammer icon now also reacts on theme changes.
Before only at start up the dark mode would be evaluated and the icon set accordingly. But not while the app was running and the user might have changed the mode.

Dvlv commented 8 months ago

Good catch, I only use light mode myself!