Slapdash Platform
GitHub
  • Ahoy, world!
  • Command Bar 101
    • How it Works
    • Core Terminology
    • Commands
    • Local Commands
    • Cloud Commands
    • Build Your First Command
    • Publish Command
    • Hooks
  • Command Tutorials
    • Toggle Dark Mode
    • Emoji Paster
    • Copy Special Character
    • Send Slack Message
  • Reference
    • Command Response
    • Action
    • View
    • List View
    • Masonry View
    • Form View
    • Tokens
    • Icon
    • Config
Powered by GitBook
On this page
  1. Command Tutorials

Toggle Dark Mode

A Mac OS command that uses AppleScript

PreviousHooksNextEmoji Paster

Last updated 3 years ago

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 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
Run Toggle Dark Mode in Command Bar
create a Local Command