ThemeServices has an OnThemeChange callback for this already. Adding it to TApplicationProperties wouldn't be a terrible idea, though it would probably be better to implement CM_THEMECHANGED/CM_STYLECHANGED in TControl, which would be VCL compatible. I haven't tested it on most widgetsets, but I do see calls to IntfDoThemeChange in them. When I tested with Qt5 on Mint Cinnamon, there were cases where it wasn't getting called correctly, but I haven't had a chance to research it fully yet. Looks like Cocoa is just watching for the system colors to have changed; this question[1] on StackOverflow implies it'll we'll need to hook into DistributedNotificationCenter instead.
1)
https://stackoverflow.com/questions/39048894/how-to-detect-switch-between-macos-default-dark-mode-using-swift-3
Zoë Peterson
Scooter Software
On 8/30/2020 11:43 AM, Alexey Tor. via lazarus wrote:
> This forum topic is about how we can react to macOS theme change.
>
https://forum.lazarus.freepascal.org/index.php?topic=43111.msg376056;topicseen#new
>
>
> and I had the idea to make all this task simpler.
> we have the TApplicationProperties. let's add OnThemeChange there!
> some widgetset funcs will be needed.
> now it's the problem - do this reaction on macOS, on win32,... no one
> knows how to do it on gtk2/qt...
> I wrote to Dmitry (Cocoa developer) about this idea, then wrote here.
>
> Alexey Torgashin
>