This is a slightly cleaned-up version of the patch I initially posted for commentary on emacs-devel. The patch makes two closely related changes: when a new frame is created, the ns-appearance parameter (which was already in Emacs) is bound to 'light or 'dark depending on the system theme. (Previously, it could be set explicitly and Emacs would respect that change on a per-frame basis, but if it wasn't explicitly set it was unbound.) Secondly, it registers an event handler for changes to the system-wide theme, and when the system theme changes, it changes the ns-appearance parameter of all frames to match the new system theme, and runs a new hook, ns-dark-mode-changed-hook so that users can e.g. set a new Emacs theme to match the new system theme or whatever. The patch is against Emacs HEAD as of time of writing. (3cbf92323c) As mentioned on emacs-devel, this is my first Emacs patch and my first time programming Objective-C in a long while, so I’d definitely appreciate feedback! Daphne Preston-Kendal