Toggle NSToolbarItem between Black and Blue

1k views Asked by At

I'd like to make an NSToolbarItem with a custom image which toggles between Black and Blue, like the icons at the top right of Xcode 5's main window.

Peter Hosey suggested in this answer that it was as simple as setting the image to be a template, but I haven't found that to be the case. I set it to a template image, and that causes it properly render the dark gray gradient, but it doesn't render in blue when toggled.

I uploaded a very simple example of what I've done, here. If someone could tell me how to change it to light up the NSToolbarItem in blue, as Xcode does, then I'd very much appreciate it.

1

There are 1 answers

2
l'L'l On BEST ANSWER

You mostly have everything you need in place, with the exception of providing an NSButton object using the style NSTexturedRoundedBezelStyle, with which you’ve associated your image.

enter image description here

modified example project here

OS X Human Interface Guidelines | Window-Frame Controls