I wanted to be able to detect when Dark mode was turned on or off in my Go program so I can swap icons in my tray app, but the Apple-blessed methods all use Swift and ObjectiveC. To work around this I figured out the following:
- When dark mode is set, a property called "AppleInterfaceStyle" is set to "Dark" for the user.
- When dark mode is disabled, that property is removed.
- You can see this by running "defaults read -g AppleInterfaceStyle"
// Dark Mode On
defaults read -g AppleInterfaceStyle
Dark