↓Skip to main content

Change macOS light and dark mode via command line

An atmospheric photo of a backlit basketball basket above heaps of snow.
Table of Contents

I normally have my macOS set to dark mode because developer, but sometimes I need to take screenshots for talk slides. For readability and accessibility, it’s important to have enough contrast, and often dark text on a light background is best.

Aliases #

Rather than having to click 🍎 > System Settings… > Appearance > Light, here’s a couple of aliases to do it from the command line:

alias light-mode='osascript -e "tell app \"System Events\" to tell appearance preferences to set dark mode to false"'
alias  dark-mode='osascript -e "tell app \"System Events\" to tell appearance preferences to set dark mode to true"'

Then I can type light-mode, take the screenshot, and then go back with dark-mode.

See also #

Some info on accessible presentations:


Header photo: Snow basketball today (CC BY-NC-SA 2.0 Hugo van Kemenade).