This is what OS X\'s built in color inversion feature can turn your screen into:
>
The way OS X itself does it is through a set of undocumented CoreGraphics API calls. I don't think they're declared in any official header file, but you can always just declare the prototypes yourself.
// clang -g -O2 -std=c11 -Wall -framework ApplicationServices
#include
#include
CG_EXTERN bool CGDisplayUsesInvertedPolarity(void);
CG_EXTERN void CGDisplaySetInvertedPolarity(bool invertedPolarity);
int
main(int argc, char** argv)
{
bool isInverted = CGDisplayUsesInvertedPolarity();
printf("isInverted = %d\n", isInverted);
sleep(2);
CGDisplaySetInvertedPolarity(!isInverted);
printf("Polarity is now: %d\n", CGDisplayUsesInvertedPolarity());
sleep(2);
CGDisplaySetInvertedPolarity(isInverted);
printf("Polarity is now: %d\n", CGDisplayUsesInvertedPolarity());
return 0;
}
There are similar API calls for other accessibility features, such as grayscale:
CG_EXTERN bool CGDisplayUsesForceToGray(void);
CG_EXTERN void CGDisplayForceToGray(bool forceToGray);