I am creating a custom view for an NSMenuItem
. In order to draw the background when selected, I adapted a couple of lines from the CustomMenus sample. The CustomMenus sample has:
[[NSColor alternateSelectedControlColor] set];
NSRectFillUsingOperation(dirtyRect, NSCompositeSourceOver);
.. and I am using the selectedMenuItemColor because the alternateSelectedControlColor was a solid color and it did not look very good:
[[NSColor selectedMenuItemColor] set];
NSRectFillUsingOperation(dirtyRect, NSCompositeSourceOver);
Using selectedMenuItemColor is better, but it's still not exactly the same as a real selected NSMenuItem
.
Here is a screenshot showing the real selected NSMenuItem
background on the left and the selectedMenuItemColor on the right in the "Blue" appearance:
You can see that there is an additional translucent white gradient overlay on the real selected NSMenuItem
background.
How do I replicate the real selected NSMenuItem
background?
EDIT: This is for Mac OS 10.9.5.
EDIT2: Here is a side-by-side comparison in the "Graphite" appearance:
pearlescent
. :-) – Cleanshaven