How can I write a script to run on a Mac that inverts screen colors?
Like How to programmatically invert screen colors in Linux , but unfortunately xcalib works on Windows and Linux, but not Mac, as far as I can tell.
EDIT: I have a partial solution. I found a way to reset all my settings before and after inverting the screen colors:
$ mkdir before && mkdir after && cd before
$ for d in $(defaults domains | sed 's/,//g'); do defaults read $d > $d; done
$ cd ../after
$
$ for d in $(defaults domains | sed 's/,//g'); do defaults read $d > $d; done
$ diff -r before after
diff -r before/com.apple.CoreGraphics after/com.apple.CoreGraphics
3c3
< DisplayUseInvertedPolarity = 0;
---
> DisplayUseInvertedPolarity = 1;
diff -r before/com.apple.universalaccess after/com.apple.universalaccess
5c5
< whiteOnBlack = 0;
---
> whiteOnBlack = 1;
So, now I know which settings are responsible for the inversion of the screen. But when I try the obvious
$ defaults write com.apple.universalaccess whiteOnBlack -int 1
$ defaults write com.apple.CoreGraphics DisplayUseInvertedPolarity -int 1
. , - , , ( , , dotfiles, , Finder ), , , .