Mac Dark Mode from Command Line

By  on  

One of the best professional decisions I ever made was switching to a dark text editor theme. I suffered from horrible headaches for years, partially caused by late night coding sessions with blindingly bright computer screens. Recently Apple implemented a dark OS theme which helps my eyes, and thinking in a command line state of mind, I was wondering if there was a way to change dark or light mode via command line...and I found out how!

Switching between light and dark mode via command line is done via a boolean flag:

sudo defaults write /Library/Preferences/.GlobalPreferences.plist _HIEnableThemeSwitchHotKey -bool true

The good news is that switching between color preferences can be done with one command; the bad news is that you need to restart your machine for the new theme to take effect.

For years I switched to dark themes on iPhone apps and text editors; I'm so thankful that Apple has afforded us this feature on laptops and desktops. Your eyes are important -- protect them!

Recent Features

  • By
    Conquering Impostor Syndrome

    Two years ago I documented my struggles with Imposter Syndrome and the response was immense.  I received messages of support and commiseration from new web developers, veteran engineers, and even persons of all experience levels in other professions.  I've even caught myself reading the post...

  • By
    CSS Filters

    CSS filter support recently landed within WebKit nightlies. CSS filters provide a method for modifying the rendering of a basic DOM element, image, or video. CSS filters allow for blurring, warping, and modifying the color intensity of elements. Let's have...

Incredible Demos

Discussion

    Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!