Switch to the dark or light theme automatically

Some operating systems such as recent versions of macOS provide the ability to adjust the appearance during the day. It is also possible to set the appearance explicitly to light or dark mode.
On macOS, you can set the mode in the System Preferences > General, and choose the mode in the Appearance section:
Update the appearance on macOS
Update the appearance on macOS
The `Viewer` component can choose the theme based on the system appearance. Whenever you change the system appearance, the `Viewer` also updates the theme instantly.
It can be done by setting the `theme` option to `auto`:
<Viewer theme="auto" />

See also