cgdisplayfade

The code snippet below fades the display to a solid blue color and back

cd:~ diciu$ cat testfade.c
#include <stdio.h>
#include <ApplicationServices/ApplicationServices.h>

int main()
{
fprintf(stdout, "Fading to blue...\n");

CGDisplayFadeReservationToken token;
CGError err = CGAcquireDisplayFadeReservation(10, &token);
CGDisplayFade(token, 2.0, kCGDisplayBlendNormal, kCGDisplayBlendSolidColor, .1, .3, 1.0, true);
CGDisplayFade(token, 2.0, kCGDisplayBlendSolidColor,kCGDisplayBlendNormal, .1, .3, 1.0, true);
err = CGReleaseDisplayFadeReservation(token);
}
cd:~ diciu$gcc -framework ApplicationServices testfade.c
cd:~ diciu$ ./a.out
Fading to blue...