Easily activate MacOS night mode via a keyboard shortcut

Easily activate MacOS night mode via a keyboard shortcut

macos 2016 iconToday we're going to see how to easily activate MacOS night mode via a keyboard shortcut. Indeed, with the new macOS Mojave, a night / dark mode is available. And if you are on Sierra or High Sierra, this same mode exists but is not as advanced.

As often on iPhoneSoft, here is a new tip for beginners that comes to fill the section Mac easy… (see all our Mac and iPhone Easy tips).

These little Mac tricks often help beginners, but can sometimes surprise even the most expert of us! If you have problems or want to share your experiences, do not hesitate to go to our discussion area on iOS and Mac.

macos mojave mac

Create a script to activate NIGHT Mode on Mac

It's not very complicated, you just have to create a small script via Automator and attach a keyboard shortcut. To do this :

  • Open Automator (search for the app via Spotlight)
  • Go to File -> New
  • Select Service then validate with "choose"automator tutorial service apple script
  • Put "no entry" in "The service receives"
  • In the search bar at the top left (near Actions and Variables), type "Apple"
  • Select "Run an AppleScript script"
  • Empty the example script
  • Enter this:

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

  • Make "Play" to test the script
  • Go to File> Save to save and name the script "Dark Mode"

write automator apple script

Assign a keyboard shortcut to activate NIGHT Mode on Mac

Again, it's very easy to assign a keyboard shortcut to an action:

  • Open System Preferences
  • Go to Keyboard
  • Go to Shortcuts
  • Choose Services from the list on the left
  • Go down to find "Dark Mode" freshly created
  • Assign a keyboard shortcut by making the desired combination (here I did: SHIFT + CMD + X)

tutorial put a keyboard shortcut on a macos night mode action

If you have a Touch Bar

To assign this action to your Touch Bar, you must return to System Preferences then Extensions and choose Touch Bar.

Check the "Dark Mode" and go to the Keyboard settings to customize the controls. It's up to you to add your new mode by dragging it. To have a nice icon, you will have to edit the script above.