views:

368

answers:

2

Is there a way to control the brightness of the OS X desktop programmatically using Cocoa or Core Animation?

+3  A: 

Create a semi-transparent full-screen view behind your main window.

Naaff
Does this answer your question? Or are you looking for any additional help?
Naaff
It does, but maybe I should have phrased it differently. I was wondering if I could control the actual screen brightness programmatically instead? Thx
Mac
Do you want to actually control the brightness of the display hardware? If so, I think you're out of luck. However, since you tagged this with core-animation, I'm thinking you maybe want some kind of full-screen visual effect. In which case you can use the CoreGraphics API call CGAcquireDisplayFadeReservation().
Naaff
+1  A: 

In case you were actually interested in doing a fade-out or fade-in of the whole screen, here is a link describing how to do that.

The linked document contains examples for how to fade all displays (or a single display) to black (you can change the color), capture the display (where you can display what you'd like), and then fade back. This uses CGAcquireDisplayFadeReservation() mentioned in the comment to my other answer.

Is this more like what you were looking for?

Naaff
This maybe a better fit of what I was trying to do. Thanks for following through. I'm going to choose this answer as the correct one.
Mac