Toggle Dark Mode

A Mac OS command that uses AppleScript

This is an example that will only work on macOS because it uses AppleScript. It's an example of a command that doesn't return a response: it just does its thing and exits.

When the command is run, it will toggle the dark mode system preference setting.

Paste the following code in a new file with a .applescript extension and then create a Local Command to try it out in Slapdash.

tell application "System Events"
  tell appearance preferences
    set dark mode to not dark mode
  end tell
end tell

See on Github

Last updated