Recently the topic of customising an NSPopover’s background came up. Searching around the internet suggests it’s not very doable; there appears to be basically no public API, and some of the tricks of poking around the popover’s view hierarchy rather scare me. ’Tis a pity, and of course I’ve filed a radar.
But in my poking around, I did discover that we have some control over the vibrancy of the popover, which can be good enough. By default, popover appearance depends a bit on the user’s settings. Whether the popover is vibrant depends on the user's “Reduce Transparency” setting in System Prefs ▸ Accessibility ‣ Display.
NSAppearance seems to be a bit of a weird one. The docs discuss things like how you “you customize a window by using Xcode to create an appearance file”. Does any such support actually exist in Xcode? Uh, no. Looks like NSAppearance is basically a feature which only truly shipped internally.
But we can at least create appearance objects from the standard names available. Give this a try:
Slightly to my surprise, this does the trick! Why?
Well, if you introspect a vanilla popover (with Reduce Transparency off of course), you’ll find it has a “composite” appearance, which comprises both Aqua, and vibrancy. If we swap that for purely Aqua appearance a welcome side effect appears to be that the vibrancy is now ditched.
All in all, I consider this a handy trick that works for now. I’m not entirely convinced it’ll work forever, and hopefully my radar will get some love soon (not holding my breath on that one!).