Not sure about how to do this in AppleScript and Automator or whether it is possible at all, but this thing is relatively easy otherwise. All you need to do is to adjust the gamma of the screen. An example from my code:
Code:
- (void) setNiteVision:(BOOL)niteVisionState {
if (niteVisionState){
// engage the nite vision by changing the screen gamma value
// the values (which determine the color an brightness) are
// taken from the module's setup where they are stored as NSNumbers
CGGammaValue gamma, min;
CGDisplayErr err;
min = 0.1;
float redMax = [[moduleSetup objectForKey:@"RED_GAMMA"] floatValue];
float greenMax = [[moduleSetup objectForKey:@"GREEN_GAMMA"] floatValue];
float blueMax = [[moduleSetup objectForKey:@"BLUE_GAMMA"] floatValue];
gamma = 1.0; // we do not want to change the curve, just adjust end points
err = CGSetDisplayTransferByFormula(
CGMainDisplayID(),
min, redMax, 1, // red
min, greenMax, 1, // green
min, blueMax, 1); // blue
}
else
// restore the default gamma curve as defined in the system
// preferences for all displays
CGDisplayRestoreColorSyncSettings();
}
Bookmarks