How to enable "real dark mode" on OS X / macOS
DISCLAIMER (PLEASE READ): the service I've written to enable dark mode in apps is just an experiment. You should not expect it to work or work reliably. I will not help anyone with this, it's just a proof of concept.
NOTE: For this service to work, you must have SIP disabled and the developer tools installed.
Yesterday I tweeted some screenshots showing certain OS X apps with a 'real dark mode' enabled. It didn't take long for the press to start writing about it, based on the original story by MacMagazine.
First of all I must correct an information posted by Cult of Mac. They said this dark mode is only available on macOS Sierra, but actually my tests were performed on OS X El Capitan, so this is not a new feature in Sierra.
With that out of the way, let's see how we can go about enabling this dark mode on system apps.
There are three big issues with the method I've used to do this:
- It's not permanent (when the app is restarted the dark mode goes away)
- It's not global (you have to enable it for each app separately)
- It requires code injection, therefore you have to disable SIP if you want to use it on certain system apps
- OS X El Capitan or later
- Xcode and command line tools installed
- SIP disabled if you want to use it on certain system apps
Disclaimer 1: Please note that, while I have SIP disabled on my machine, I do not recomend it to anyone, it's an important security feature and you should only disable it if you know the implications.
Disclaimer 2: I am not responsible for any issues you might face while trying this out. If you computer blows up, it's not my fault.
I have tested this successfully with System Preferences, Text Edit, Finder and Safari. The more standard system controls the app uses, the better it will support dark mode (more on this later).
Download this zip file and extract it to ~/Library/Services.
Now open the app you want to apply dark mode to, on the menu select the app menu > Services > Apply Dark Mode.
After a few seconds the app should be dark.
Until the app is terminated, all it's windows will adopt the dark appearance, to disable the dark appearance, just restart the app. If you've applied it to Finder, you can restart it by running killall Finder on Terminal.
How does it work?
All my bundle of code does is to apply an appearance called DarkAppearance on all windows and UI controls of the active app. This appearance first appeared on Yosemite and is located in /System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/DarkAppearance.car. If you want to see what's in this file, you can use my app Asset Catalog Tinkerer.
I had the idea to test this after watching the session "Crafting Modern Cocoa Apps" from this year's WWDC. When talking about system appearances the presenter told the developers that they should use as many built in controls as possible to make their apps adapt to different system appearances. This is why, from all the apps I've tested this with, System Preferences is the one which better adapts to dark mode: it only uses standard system controls.