(Swift, macOS)
I have a label inside an NSView and a window that are transparents. I try to make the Window transparent, the NSView semi-transparent but keep the Label non-transparent.
This makes the NSView1 and the Label1 semi-transparent:
@IBOutlet weak var NSView1: NSView!
@IBOutlet weak var Label1: NSTextField!
@IBAction func button1(_ sender: NSButton) {
// window transparent:
view.window?.isOpaque = false
view.window?.backgroundColor = NSColor.clear
// NSView 50% transparent
NSView1.wantsLayer = true
NSView1.layer?.backgroundColor = NSColor.white.cgColor
NSView1.alphaValue = 0.5
// I tried a label non transparent, but I still see the label semi-transparent :
// Label1.backgroundColor = NSColor.black.withAlphaComponent(1)
// Label1.backgroundColor = NSColor.black
}