I'm using NSPopover
, and when I change the system dock color to dark (Yosemite new feature) some elements in my view invert their color.
For example some labels changes from black to grey, or text fields background changes from white to black. And if I have a view with white background it is now changes to the blurred dark effect.
So two questions:
Can I cancel this behaviour and force the UI to act like in regular mode?
Is there any rules here which element invert their color?
Because it seems that some element changes and some not.
This is my app in Yosemite regular mode:
And this is in Yosemite dark mode:
It might be a library you're using that's causing this behavior. I just tested on a new project and I couldn't make the NSPopover black no matter how hard I tried.
What libraries are you using ? How did you set up your NSPopover ?
Maybe you could try changing the appearance property of the view ?
view.appearance = [NSAppearance appearanceNamed:NSAppearanceNameAqua];
NSView has the property appearance
because it conforms to NSAppearanceCustomization.
Also see NSAppearance.
————————————————————————
Found the solution:
self.popover.appearance = [NSAppearance appearanceNamed:NSAppearanceNameAqua];
the result:
There are ways to do this, though I would recommend embracing it. It's not concretely documented what will change and how. But observation will show you what to do. Primarily it requires you do the opposite of opting in. Opting in is using Appkit interface elements as is as well as using the NSColor names provided as system colors and using the NSVisualEffectView. That means to explicitly opt out you need to go around and basically customize views and that mostly means setting explicit colors and occasionally subclassing. Out of the box HUD style popovers and panels would be opting in.
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