I am working on a Mac app. I was wandering if it is possible to change the title bar colour in a NSWindow? I know how to remove it, but the problem with that is that it removes the three buttons as well (close, minimise, resize). I want to keep the three buttons but get rid of the bar.
Is there anyway to do this?
Yes, it's been done here on SO:
How to Change Color of NSWindow Title Bar in OSX
They say that one-link answers are bad form here, but heck-- it does mostly what you're asking. And it works-- I've tried it myself.
The couple things to notice: his code there just works on the default window of NSApp... so you will need to do a bit of work to generalize it to the case of your / "any" NSWindow. ( Take that code that he puts in the AppDelegate and move it to your own subclass of NSWindow or your NSWindowController. Probably the controller. )
Also, he says to subclass NSView with "MyTitleView", but in the code, it's actually called "BlackTitlebarView"... Just pick one name, be consistent, and it's fine. Also, the color of the title text is in the drawString: method, where he has [NSColor whiteColor]. Also, he gets fancy with gradients, which you'll see when you run the code... If you don't need or want that, you can replace chunks of his code with simpler stuff to just draw a single color... but you might think about using the fancy stuff anyhow since you're getting it for free.