NSTableHeaderCell and controlBackgroundColor for Dark Mode

72 views Asked by At

I've been trying to customise a NSTableHeaderCell, for this I created a subclass of it and implemented the func draw(withFrame cellFrame: NSRect, in controlView: NSView) where I draw the background with the NSColor.controlBackgroundColor.

Problem is that it doesn't seems to adapt to the different macOS darkAqua color of the different macOS version and basically stay black all the time.

I've seen that on the documentation Apple mention this: "Do not use this color for drawing. Instead, use an NSVisualEffectView with the appropriate background material."

How can I achieve this ?

I've been trying to add a NSVisualEffectView like this tableView.headerView?.superview?.addSubview(visualEffectView) problem is that my NSTableHeaderCell doesn't seems to be able to be completely transparent and stays with some kind of light gray.

Does anyone know how I can achieve this ?

0

There are 0 answers