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
    5 Awesome New Mozilla Technologies You’ve Never Heard Of

    My trip to Mozilla Summit 2013 was incredible.  I've spent so much time focusing on my project that I had lost sight of all of the great work Mozillians were putting out.  MozSummit provided the perfect reminder of how brilliant my colleagues are and how much...

  • By
    CSS vs. JS Animation: Which is Faster?

    How is it possible that JavaScript-based animation has secretly always been as fast — or faster — than CSS transitions? And, how is it possible that Adobe and Google consistently release media-rich mobile sites that rival the performance of native apps? This article serves as a point-by-point...

Incredible Demos


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