Here's an improved version of the documentation for dark mode functionality:
---
### Dark Mode Integration
To enable dark mode in your application, add the following data attributes:
1. **On the `` tag**:
Use `data-controller="dark-mode"` to initialize the dark mode Stimulus controller on the body of your page.
2. **On elements that should toggle dark mode**:
Use `data-action="click->dark-mode#toggle"` to attach the dark mode toggle functionality to any clickable element.
This setup ensures that when the user clicks the element with the `data-action` attribute, the dark mode controller toggles the color scheme between light and dark.
For example:
```html
```
In this setup:
- The `dark-mode` controller is responsible for adding or removing the appropriate CSS class on the ``.
- The button uses the `click->dark-mode#toggle` action to toggle between light and dark modes on user interaction.