Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Toggle NSToolbarItem between Black and Blue

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.

like image 973
ArtOfWarfare Avatar asked Dec 31 '13 05:12

ArtOfWarfare


1 Answers

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

like image 63
l'L'l Avatar answered Nov 20 '22 13:11

l'L'l