# Toggle Dark Mode

![Run Toggle Dark Mode in Command Bar](/files/ihkzuuNpnBMXhqiTdaGJ)

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](/command-bar-101/local-commands.md#create-local-command) to try it out in Slapdash.

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

[See on Github](https://github.com/slapdash/platform/tree/main/tutorials/toggle-dark-mode)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://platform.slapdash.com/command-tutorials/toggle-dark-mode.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
