I am trying to make a custom toolbar to use anywhere. I want the background to look like the gray that the nstoolbar has. The color is used in several places like the top of Safari or Mail.
Does anyone know of an easy way to draw it? Or use the nstoolbar somewhere other than the top of a window?
You'll want to create an NSGradient with two colors (the "top" and "bottom"), then draw the gradient into the desired rectangle ([self bounds]?). You can get system colors from the NSColor API reference (there are class convenience methods for system colors). I'm not sure exactly which the bar uses, but that should be enough info to get started.
+[NSColor colorWithCalibratedRed:green:blue:alpha:]If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With