Tuesday, April 9, 2019

Toggle System Grayscale Mode

Daniel Jalkut:

The framework name “UniversalAccess” correlates strongly with the “UA” prefix on the pertinent function names we dug up above. Great, so how do we call these? They’re private system functions which means you should not rely on them for production code, but for a quick hack to make toggling grayscale easier? It’s a reasonable risk in my opinion. Here’s a simple C program that takes advantage of the private methods to simply toggle grayscale mode on or off, depending on the current setting.

This is arguably more reliable than using GUI scripting, and definitely faster and less intrusive. Or, if you don’t want use a compiler:

This script takes advantage of Python’s ability to dynamically load an arbitrary shared library and invoke its exported functions.

Update (2019-04-10): Marco Arment:

I love this kind of power and customization, and it’s the kind of thing we’re losing with the dominance of iOS itself and the invasion of the iOS mindset into macOS

1 Comment RSS · Twitter

[…] as as a Mac advantage. And it also means lots of practical changes; AppleScripts can no longer lean on other scripting […]

Leave a Comment