If you’re anything like me, you enjoy changing between dark mode and light mode based on what vibe you’re feeling.
Here’s a quick and to-the-point tutorial where I'll show you how to add a shortcut to your MacBook's Touch Bar that makes switching all that much easier.
Very simply, we’ll be creating an Automator script that allows us to create a shortcut for dark/light mode. Once we have the script set up, we will add a Touch Bar shortcut to make switching between the two modes easier.
If you're not familiar with any of these things, don't worry as I've listed each step with helpful screenshots to guide you. We've got this!
- MacBook w/Touch Bar 👆🏽💻
- macOS Mojave
Create the script that automates the light → dark mode process
→ Open Automater
→ Create a New document
→ Create a quick action, and then click "Choose"
Implementing the script
Change the workflow selection to "no input"
Change the image to your desired icon. This will appear on the Touch Bar. I selected the color wheel.
In the Actions search bar type "Run AppleScript"
Double click "Run AppleScript" and you’ll see this page
Delete the existing code, and replace it with the following code:
tell application "System Events"
tell appearance preferences
set dark mode to not dark mode
It should look like this:
Let's test out the script by clicking the "Run" button
Switch back to the light mode by clicking "Run" again.
Let's go ahead and save the script. I named mine “Dark Mode Toggle”
Creating the Touch Bar shortcut. We’re almost there!
On System Preferences → Extensions, make sure the Dark Mode Toggle is checked
Click on Customize Control Strip
This will take you to this page, where you can drag your quick action to your desired location on the keyboard. I chose to put mine on the far right.
Note: you'll have to drag it towards the desired place on your Touch Bar. See more here.
Congratulations, you did it! 😎
Connect with me on Twitter @oiHamza. 👨🏽🚀