I’m wondering if anyone has a good way to detect when the system changes from light to dark mode and back again while a program is running. The issue is that I have an application where I have some custom colors defined for text, backgrounds, etc. If the program is running and the system toggles from light to dark, everything that is default (presumably system colors) changes. However, all of my custom colors stay the same.
I know that I can use SystemAppearance to detect dark, and I can use that on startup to set my custom colors appropriately. However, if a user changes it while they’ve got the program open there’s no callback or anything like that, so at the moment the best I can come up with is do something like set a timer that checks to see if dark mode has changed every x seconds, then update my custom colors as appropriate. This is a hack, and I"m hoping there’s a better way to do it.
Does anyone has any thoughts on a better way to do this?