Easily toggle between light and dark mode in macOS Mojave

Apple has added a new dark mode, Dark Aqua, to macOS Mojave. Since there’s currently no easy way to toggle between the two modes, I’ve created a button you can add to your MacBook Pro’s Touchbar that allows you to quickly move from and  to the dark side.

Steps

  1. Create a Contextual Workflow in Automator and add the code below.
  2. Set the input to none, and pick a good icon.
  3. Save the workflow and give it a clear name like Dark Mode.
  4. Go to System Preferences > Extensions and choose Touch Bar.
  5. Enable your newly created workflow
  6. Go to System Preferences > Keyboard and choose Customize Controlstrip
  7. Drag the Workflow button to your Touchbar

The code

tell application "System Events" tell appearance preferences set dark mode to not dark mode end tell end tell

Screenshots

The result