var darkMode = Application("System Events").appearancePreferences.darkMode; darkMode.set(!darkMode.get());
You can build an application from this code using
File > Export...and then use it as part of any other automation scheme (e.g., Login, Calendar, Keyboard Shortcuts).
How it works:
But really, you should work in Script Editor, because it has all the documentation and library methods built-in.
Window > Library for a list of all the applications you can work with.
OS X 10.10 also comes with a new Dark Mode, which can be toggled in
System Preferences > General.
The process mirrors the UI.