How to set global theme with arsd.minigui?
Adam D. Ruppe
destructionator at gmail.com
Sat Mar 8 22:36:17 UTC 2025
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.
More information about the Digitalmars-d-learn
mailing list