Disabled vibrancy of child-items in a NSVisualEffectView.

In my new OSX example cocoa app, I'm trying to programmatically set the visual effect of my NSVisualEffectView.

In order to do this I use the following code:


var example : ExampleViewController = ExampleViewController(nibName: "ExampleViewController", bundle: NSBundle.mainBundle())!
example.visualEffectView.appearance = NSAppearance(named: NSAppearanceNameVibrantDark)
example.visualEffectView.material = NSVisualEffectMaterial.Titlebar


In my visualEffectView I have an Image Well. The problem is that this Image Well's style is affected by the visual effect view.


The problem can be seen here: http://i.imgur.com/SjkRdrY.png


How exactly can I disable the transparency and vibrancy changes to the octocat logo which is within this Image Well, while maintaining the black blurred background style?

It looks like you would need to have the Image Well be a sibling view of the effect view (a subview of the effect view's parent view), instead of a child of the effect view.


https://developer.apple.com/library/mac/documentation/Foundation/Reference/NSVisualEffectView_Class/


With in-window blending, vibrancy is achieved by setting the layer’s compositing filter. The compositing filter applies to the layer and all its children, that means a child view will always be vibrant. However, you can add non-vibrant sibling views over the vibrant view; the overlapping sibling views will not be vibrant.

I'm sorry, LCS, but I'm not sure that's correct. What I understand is that it's simply a matter of NSView's allowsVibrancy property, called at every draw cycle. Subviews of a visual effect view can stop vibrancy from happening by returning false or opt in by returning true. I'm not sure what the default is. Once a subview has been declared as allowing vibrancy, however, all of its subviews must be vibrant as well. Check out the


I looked at your screenshot and I'm not sure exactly what you need help with. Are you trying to keep your logo distinct and black even if it's on a dark vibrant background? Or are you trying to get it to invert to white when in a dark vibrant background?


It's perfectly okay for you to put your image well inside the visual effect view. The question is how to control whether or not the image well allows vibrancy. You could subclass and override the method, but there's a simpler way: whether or not the image is a template. Template images are used solely for their alpha values and are assigned appearances based on context (e.g. on your light background it will be dark; on your dark background it will be light). If you're looking for that adaptive behavior, just change your resource's file name so that it ends with "Template" or call image.template = true after it's created. If you're looking for the same behavior regardless of context, make sure your image isn't a template.


I've tried disabling vibrancy using sibling views instead of child views before, but that hasn't worked for me.


If you still need help, I'll be available.



NSVisualEffectView class reference:

https://developer.apple.com/library/prerelease/mac/documentation/Foundation/Reference/NSVisualEffectView_Class/index.html#//apple_ref/doc/uid/TP40014765


You also should look at the "Adopting Advanced Features of the New UI of OS X Yosemite" video from WWDC 2014 for a thorough discussion of your problem.

https://developer.apple.com/videos/wwdc/2014/

Does setting the NSAppearance of the view to NSAppearanceNameAqua not work?


By setting the Appearance of the container to VibrantDark, I believe that is inheritted by all subviews. Perhaps try setting the ImageWell's appearance to Aqua?

Disabled vibrancy of child-items in a NSVisualEffectView.
 
 
Q