2008 05 01Changing the background color of an NSButton
If you want to color or visually change one of your controls, the easiest way to do it is with Core Image. In Interface Builder, click wants Core Animation Layer, and add content filters.
This one uses Color Monochrome to color the button. In Dynamic overloading : sample code, I used Color Matrix but strangely it's not available in my version of IB. Well, you can always set it up in code. It's better than overloading all
NSButton
s' drawRect
— that's quite overkill to color just one button. :)
Neat stuff. I don't think I'd have found this on my own. I think it's ok for some button styles, but I wonder if there's a way to tweak it so it doesn't color the grey pixels around anti-aliased text. Thanks for sharing.