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

Incredible Demos

  • By
    jQuery Chosen Plugin

    Without a doubt, my least favorite form element is the SELECT element.  The element is almost unstylable, looks different across platforms, has had inconsistent value access, and disaster that is the result of multiple=true is, well, a disaster.  Needless to say, whenever a developer goes...

  • By
    :valid, :invalid, and :required CSS Pseudo Classes

    Let's be honest, form validation with JavaScript can be a real bitch.  On a real basic level, however, it's not that bad.  HTML5 has jumped in to some extent, providing a few attributes to allow us to mark fields as required or only valid if matching...

Discussion

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