Is it even possible to make NSPopver fully transparent? - macos

I tried my hands on changing the color of NSPopover, I am able to change to it all desired color except transparent.
As, it is known that NSPopover is by default semi transparent. I tried changing the NSWindow color directly, by Layer as well, I also tried setting the NSView's color to transparent i.e. NSColor.Clear but no luck.
So the question is - Is this possible to change the background color of NSPopover to transparent?

No this is (sadly) not possible.

Related

Why does my NSBox draw a background? (boxType = .primary)

I realized that suddenly (without me touching the corresponding code) my NSBox has a double visualization. It is as if the Box has a background color and draws its normal rounded frame inside. I added a small screenshot. The parent control is white, the NSBox is gray with the title "Inputs" (unchanged titlePosition). Under the title is the normal box, adding a 2nd shade of gray.
I did not change any of the usual suspects, especially not boxType which is still set to .primary.
I did work on the Dark Mode (Dark Aqua) but cannot see any change that would cause this behaviour. effectiveAppearance is still Aqua.
A NSBox with a boxType of .primary always draws a background. That is intended behaviour. Only if the view behind NSBox is white you may not see it. If you want a NSBox without background you must make it boxType .custom and set the background color as required.

How to "tint" UIVisualEffectView on iOS 8+? Or, create a blurred background view with a tint color?

Self-explanatory. UIVisualEffectView only has a light, dark, and "extra light" tint variation. Is there a way to tint with a color instead, such as the tint color of the app?
UINavigationBar sort of does this, I think, in that it has transparency and blur... but also a tint color.
Third-party libraries are OK, but I'm not sure where to look for this.
You can tint the UIVisualEffectView using this library:
https://github.com/efremidze/VisualEffectView
Set a UIView with an alpha of 0.5 or so with a background color. In front of that put a UIVisualEffectView. Remember to not set the visual effect view as a subview of the first background view.
That should do the trick.
It seems like FXBlurView is the way to go currently for tinted blurs. https://github.com/nicklockwood/FXBlurView
You could maybe put it in a UIView that had a semi-opaque background color of the opacity to your liking...

Access Default Window Color Cocoa

I have an SKView with a picture of a keyboard in a window as shown below. I would like the background color of the SKScene it's presenting to be the same color as the window behind it, so that it would appear as if the keyboard was just in the window, and not in something else that was in the window. After consulting the NSColor documentation, I tried setting the background color of the SKScene as NSColor.windowBackgroundColor(). The color below is what I got. I'm assuming there was some kind of error and so it defaulted to black. That being said, how do I access the default color of a window?
Set the SKView's allowsTransparency to true and then set the SKScene's backgroundColor to NSColor.clearColor().
I think that using windowBackgroundColor() gives black if the view doesn't allow transparency and works if it does because it's effectively being translated to clearColor() by "accident". windowBackgroundColor() is a bit strange. It's not in either an RGB nor a gray-scale color space and it can't be converted to either of those. I'm guessing that SKScene tries to convert the background color to the RGB color space and, when that fails, it uses clearColor() as a fallback.

NSTextField draws partially transparent text when drawsBackground = YES

I have an NSTextField. I want it to draw text and have a background color. But when I set drawsBackground to YES, the text seems to draw partially transparently. For example, if I set the text color to white and background to black, the text comes out gray. Why is this?
Make sure isEnabled set to true.
I was seeing this as well and changing this fixed it for me.

Hiding Titlebar in NSWindow, rounding the corners and keeping the shadow

I like the way the developers behind Vox.app have created a custom titlebar and still kept the original shadow.
If you set the styleMask = NSBorderlessWindowMask it will create another kind of shadow, and the rounded corners are gone.
And it doesn't seem to be that easy to recreate those shadows especially when you also want rounded corners.
I have taken a window shot of the app that I like. Look at the drop shadows and the title bar.
Is it possible (I assume) to do this? And if so, how?
Is it possible (I assume) to do this?
Yes, this is possible.
And if so, how?
You need to subclass the NSWindow and NSView, set the background color, use custom buttons etc.
For curvy-corners, you need to draw using bezier path. I tried reached somewhat near, however titlebar's color is not changed in this screenshot... but I hope you can do it from here:

Resources