Apple makes it easy to switch between light and dark mode in macOS. Regardless of whether you’re just changing the Dock and Menu Bar (in Yosemite through High Sierra) or the entire system with Mojave’s new dark mode, you can swap between the light and dark options just by clicking a button in System Preferences.
But that’s still a few extra clicks, which can add up if you want to manually change light and dark modes multiple times throughout the day. Surely there must be a better way! Of course there is, it’s AppleScript.
As noted by reddit user MirRelevant, a simple AppleScript app can let you switch between light and dark modes in any recent version of macOS with just a single click. To create your own script, launch AppleScript Editor on your Mac and enter the following code:
tell application "System Events" tell appearance preferences set dark mode to not dark mode end tell end tell
Save the code as an application and give it a name and a location. You can now double-click to launch and test your dark/light mode switcher. Remember, if you’re not running Mojave, all you’ll see change is the Dock and Menu Bar (and Menu Bar menus, of course). On Mojave, you’ll get the full dark/light mode shift, including wallpaper changes if you have that option enabled.
If everything is working, drag your app to your Dock. From here, simply click once on the mode switcher app to change between light and dark mode in just a single click.