I have a script to toggle dark mode using
tell application "System Events"
tell appearance preferences
set dark mode to not dark mode
end tell
end tell
However, this causes every application to instantly change from light to dark mode, as soon as it can. If I use the system preferences to toggle dark mode, all apps simultaneously have a slow fade from light to dark mode (or vice versa). Though this is a very minor aesthetic change, I would like to have the fade occur when I use my script to toggle dark mode. Is there a way to toggle dark mode the same way system preferences does so that it initiates the fading toggle?
activate
with System Preferences, use e.g.reveal pane id "com.apple.preference.general"