VS Code recently added the ability to switch themes when macOS's dark mode changes. Presumably they use the Electron API, which internally uses the Objective-C API of subscribing to the AppleInterfaceThemeChangedNotification
event in NSDistributedNotificationCenter
.
It would be nice if Emacs had this same ability. The pseudo-code would be:
(add-event 'os-dark-mode-changed
(lambda (on)
(set-theme (if on
some-dark-theme
some-light-theme))))
(In VS Code, the dark and light themes are configurable.)
Does Emacs have the ability to do something similar?
ns-dark-mode-change-hook
which you could use to do this. Hopefully it will be accepted, and then a future version of Emacs will have this feature!