如何编写脚本以在Mac上运行以反转屏幕颜色?如何以编程方式反转Mac上的屏幕颜色
与How to programmatically invert screen colors in Linux类似,但不幸的是xcalib可以在Windows和Linux上工作,但不是Mac,据我所知。
编辑:我有一个部分的解决方案。我找到了一种方法转储全部的我的设置,前后翻转屏幕颜色后:
$ mkdir before && mkdir after && cd before
$ for d in $(defaults domains | sed 's/,//g'); do defaults read $d > $d; done
$ cd ../after
$ # System Preferences > Universal Access > Display > White on Black
$ 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;
所以,现在我知道什么是设置负责屏幕反转。但是,当我尝试的明显,
$ defaults write com.apple.universalaccess whiteOnBlack -int 1
$ defaults write com.apple.CoreGraphics DisplayUseInvertedPolarity -int 1
什么都没有发生。大概无论使用什么程序,都需要告诉这些值重新加载它们(因为例如dotfiles需要杀死Finder才能生效)。但我不确定那些应用会是什么,或者无论如何这是否是正确的解决方案。
你为什么要这么做? –
提醒自己在编码时定期查看屏幕。建议? –
我猜想WindowServer进程需要微调来注意设置更改,但我不知道如何。如果你真的杀了WindowServer,我认为它会杀死任何GUI应用程序。 – JWWalker