2

Inside an NSPopover, some subviews (e.g., labels, push buttons) have vibrancy enabled automatically. This makes my app looks very bad when the content behind the popover is in dark colors, unless the user turns on "reduce transparency" in System Preferences. If I subclass the content view of the popover, and set allowsVibrancy to false, it makes the entire popover translucent, which looks better. However, I think my app looks the best when vibrancy is disabled entirely.

My question is, how do I disable vibrancy for all views, without subclassing each of NSView subclasses?

Ethan
  • 18,584
  • 15
  • 51
  • 72

2 Answers2

1

You could set your popover to use a solid color with this trick:

How to change NSPopover background color include triangle part?

Community
  • 1
  • 1
Stefanf
  • 1,663
  • 13
  • 15
  • Disabling vibrancy and setting custom background color are not the same thing. Disabling vibrancy makes the view opaque only - it doesn't change the default background color which should match the theme (light or dark) used by the OS. – Ethan Nov 27 '16 at 02:13
0

You can accomplish this by setting the appearance of the Popover (or any other view you want to make sure is non-vibrant) to have the NSAppearanceNameAqua appearance. e.g. popover.appearance = [NSAppearance appearanceNamed:NSAppearanceNameAqua];

Otherwise, by default, popovers will have the VibrantLight appearance.

Taylor
  • 3,183
  • 17
  • 18
  • 1
    The problem of setting `NSAppearanceNameAqua` is that the popover will always use the light appearance even if the OS theme is set to dark. The only way I found to disable transparency while respecting OS theme is to subclass each `NSView` and set `allowsVibrancy` to false. – Ethan Nov 29 '16 at 05:43