swiftmacoscocoansbuttonnsvisualeffectview

Make NSButton translucent


I have 2 NSButtons on a NSVisualEffectView. The first buttons image is the system NSEnterFullScreenTemplate image. The image on this first button is translucent.

On the second button I have an image that I imported in Assets.xcassets. On this second button the image is not translucent (it stays white).

How can I make this image also translucent?


Solution

  • By using the template setting on NSImage:

    button.image.isTemplate = true