digitalmars.D.learn - How to set global theme with arsd.minigui?
- TheZipCreator (13/16) Mar 08 I'm using the arsd.minigui package for a project, and I want to
- Adam D. Ruppe (23/29) Mar 08 Make one using those like this:
I'm using the arsd.minigui package for a project, and I want to add a dark theme/light theme switch. It seems that there's support for theming in minigui, but the documentation isn't exactly clear on how to do it. I found `DefaultTheme`, `DefaultLightTheme`, and `DefaultDarkTheme`, but how do I actually set my project to use them? Also, the docs say:These don't apply to non-custom widgets! They will use the operating system's native theme unless the documentation for that specific class says otherwise.But at least for me under Debian 12 (GNOME 43.9) it seems that the system theme isn't applying; the application appears in light mode despite the fact that I have my system theme set to dark (specifically `HighContrastInverse`). I'd prefer users to be able to set their own theme, however, regardless of the system theme (if that's possible).
Mar 08
On Saturday, 8 March 2025 at 20:13:57 UTC, TheZipCreator wrote:I'm using the arsd.minigui package for a project, and I want to add a dark theme/light theme switch.Make one using those like this: class ThisVisualTheme : VisualTheme!ThisVisualTheme { mixin DefaultDarkTheme; } Then set it somewhere by doing WidgetPainter.visualTheme = new ThisVisualTheme(); You can set WidgetPainter.visualTheme = null; to go back to the default. So if you want to do a runtime toggle put that in a button handler or something. I keep tweaking these things so some details might change if you pull from master or use the next tag (which is scheduled for May).But at least for me under Debian 12 (GNOME 43.9) it seems that the system theme isn't applying; the application appears in light mode despite the fact that I have my system theme set to dark (specifically `HighContrastInverse`).On Linux, ALL minigui widgets are "custom" widgets; the docs are written with a bit of a Windows bias. On Windows, things generally follow the system theme because they are controls provided by the system. On Linux, it is all done by minigui and thus "custom", purely internal. If you know how to read the system theme and apply it, I'd appreciate some pointers. I can't stand GNOME (or anything that uses gtk really) so I don't even know how to use it at all. But in theory, the default visual theme could read at least the basic colors and return them to apply to minigui too.
Mar 08