Applescript to Switch to Dark Mode is macOS

I found this script online back in 2018 and it still works in Sonoma. Fire it using LaunchBar, natch.

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

It will switch to dark mode and back again, somehow.