Reputation: 4229
I want to have a unified toolbar and therefore I found this post:
How can I create Yosemite-style unified toolbar in Interface Builder?
self.window.titleVisibility = NSWindowTitleVisibility.Hidden
works perfect.
But is there a way to change the background color for the toolbar? I tried with self.window.appearance = NSAppearance(named: NSAppearanceNameVibrantDark)
, but this only brings a complete black toolbar (that's too dark). I want to have a custom color.
Upvotes: 5
Views: 4570
Reputation: 11
I have used this solution to customize the title bar. However, since 10.15.4 and apparently on Big Sur, the toolbar is broken. If you have a toolbar with the window, the toolbar will placed on the top edge of the window, as if there is no title bar.
Upvotes: 1
Reputation: 4229
This one works:
https://stackoverflow.com/a/28692893/2062613
Set the window to textured in IB (I don't see a possibility to do it at runtime)
Use this code:
self.window.titleVisibility = NSWindowTitleVisibility.Hidden
self.window.backgroundColor = NSColor.whiteColor()
UPDATE:
To prevent, that the toolbar becomes transparent in Yosemite (if you have a scrollview below the Toolbar), use this code:
self.window.appearance = NSAppearance(named: NSAppearanceNameAqua)
Upvotes: 7