通过终端或 Applescript OSX 10.1 启用 Yosemite 的深色模式

Enabling Yosemite's Dark mode through Terminal or Applescript OSX 10.1

有什么方法可以通过 Shell 脚本(终端)或 Applescript 打开 Yosemite 的深色模式吗?我试过:

sudo defaults write /Library/Preferences/.GlobalPreferences AppleInterfaceTheme Dark

但是没用。

请帮忙!

您可能需要重新启动一些服务才能刷新它:

sudo killall Dock;killall SystemUIServer;killall Finder;killall cfprefsd

我想通了。

我在 Applescript 中是这样做的:

do shell script ("sudo defaults write /Library/Preferences/.GlobalPreferences.plist _HIEnableThemeSwitchHotKey -bool true") with administrator privileges
tell application "Finder" to activate
delay 0.2
tell application "System Events"
key code "17" using {option down, control down, command down}     #Option+Control+Command+T
end tell

我专门为此目的制作了一个命令行应用程序:dark-mode