Reputation: 5293
I'm trying to set a background color of NSWindow's title bar (and than change the title bar text color) and I'm stuck.
The problem was solved on SO before using Obj-C and with usage of external plugins but there must be a simple way to do it.
Did anyone encounter such issue before and would share a code (written in Swift)?
Upvotes: 2
Views: 2397
Reputation: 959
I know this was asked nearly two years ago but I figured I should say something.
Apple do not allow you to set the title text colour to custom values. Especially if you want to submit to the app store.
If however you just want to change the colour to white, you can do this. Setting the window appearance to vibrant dark will change the text colour to white using a function that apple don't give us access to.
You can then change the background colour of the title bar as you wish:
Here's an example:
self.view.window.appearance = NSAppearance(named: .vibrantDark)
self.view.window.titlebarAppearsTransparent = true
self.view.window.backgroundColor = NSColor(red: 93/255, green: 181/255, blue: 181/255, alpha: 1.0)
Looks like:
Upvotes: 2