Dark Mode Quick Toggle on MacOS
I’ve been building and testing new email templates at work this week. Part of that is implementing dark mode support. After manually toggling light and dark mode a dozen times via System Preferences, I figured there had to be a better way to quickly toggle dark mode for testing.
Sure enough, there was. I’m documenting it here in case anyone else needs it.
At first, I thought I might have to write some AppleScript. But Apple’s Automator tool makes this almost trivial. All you have to do is open up Automator and create a new document. From there, you’ll be prompted to choose what kind of document you want to make. Select Application.
From there, you’ll see the Library on the left with a bunch of Actions listed. Use the search bar to look for an Action called “Change System Appearance” and drag it onto the Automator canvas.
You’ll see that, by default, the Action is set to toggle light and dark mode. Exactly what we want! All you have to do is go up to File > Save and save the Automator file somewhere. Name it something like “toggle-dark-mode,” as that’ll be the name used to trigger the switch. Once it’s saved, you can use Spotlight to quickly trigger the action.
Just type ⌘ + Space, or whatever your Spotlight keyboard shortcut is, and start typing in the file name you used. Spotlight’s smart enough to autocomplete it, so just hit Enter and Apple will apply the change, switching from light to dark mode or dark to light mode, depending on your current setting. You may get a warning on the first run, so just accept it and be on your way.
No more menu diving and manual mode switching for me!