I’ve been doing some theme-related automations recently, e.g. changing my wallpaper based on my current focus mode, a la iOS 16 – and I wanted to change the macOS accent colour.
I’ve written a Swift script that can modify the accent colour, e.g.
$ set_accent_colour red
will set the accent colour to red, and also update all your running apps – as if you were using System Preferences, but without having to click anything.
I’m sure I’m not the only person who wants to do this, but I couldn’t find an existing example of it working the way I wanted – the Google results I found were either UI scripting the System Preferences app, or setting a preference and then restarting all your apps.
If you’re interested, I’ve put the script on GitHub: pathscripts/set_accent_colour at main · alexwlchan/pathscripts · GitHub
There’s also an accompanying blog post explaining how I wrote it: Changing the macOS accent colour without System Preferences – alexwlchan
Caveat: I’ve only tested on Monterey.