My upcoming plugin supports Light, Dark, and High Contrast themes on per-module basis:
pachde1/docs/index.md at main · Paul-Dempsey/pachde1 · GitHub (drill down to see each module and their themes).
The proposed scheme is nice enough for developers using panel SVGs, although it does mean a developer must maintain parallel SVGs, which can be a hassle.
In addition to the panel creation help for panel SVGs, there is a need to be able to query what variety has been chosen. When I was implementing theming, I initially considered following the Rack setting, but I found that the Rack modes aren’t initialized at the point when I needed to query it (it was always Light, even when I’d chosen Dark).
Only one of my panels uses an SVG, and even then, most of the UI is procedural.
Theming doesn’t apply just to panels. It needs to apply to widgets as well: knobs, screws, ports – all the things, so you’d need a way to support that as well.
If there is a querying mechanism for the Rack preference, I’d offer a per-module option on whether to follow Rack’s theme or not, defaulted to following Rack, but offering the ability to override.
Of course, this also implies notification of when the Rack theme is changed (possibly per-widget like other notifications).
Of interest to the discussion: I’m working on a way to theme Rack SVGs in-place based on a style sheet (in JSON), so you only need to maintain one SVG, and can modify the SVG on-the-fly when desired.
The proposal doc is here: pachde1/dev-notes/svg-theme.md at main · Paul-Dempsey/pachde1 · GitHub. Note that this can be applied to any widget where you know how to reach it’s NSVGimage, including your panel widget.
I’m almost finished with the MVP implementation. It’s sort of working, but few issues left to run down. I was surprised how well it worked on the very first run! There are some features to add to make it easier to use, such as defining an svg provider interface you can dynamic_cast a widget to and reach all it’s svgs for modification. There’s likely another helper or two to make it as simple to use as possible, including a method to add a complete Theme selection menu for the module.
If you implement an api to query and respond to theme changes, I’d add support for that.