Changing Accessibility Settings from Within a Script

Hello,

Recently, I've been hacking at trying to find a way for the colors of the system cursor to be changed via an executable (in particular, I'm trying to get them to match the foreground/background colors chosen by wal.) In my most recent investigation, I've located the relevant setting in ~/Library/Preferences/com.apple.universalaccess (which is a wierd place for it to be, but w/e) and attempted to change it via defaults write. This immediately caused all my GUI apps including Finder to crash repeatedly until I went into recovery mode and deleted the changed file.

My next direction in this quandary, then, is to make an application that asks for the relevant Accessibility settings (via the standard prompt that I often see) and upon being granted proper permission, is able to make the modifications without breaking the system.

Is anyone able to point me towards the documentation for such functionality, if it's possible? Preferably some kind of C or shell interface.