问题
Is there a way to control the brightness of the OS X desktop programmatically using Cocoa or Core Animation?
回答1:
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?
回答2:
Create a semi-transparent full-screen view behind your main window.
来源:https://stackoverflow.com/questions/818829/how-to-dim-os-x-desktop-using-cocoa-core-animation