I'm looking for a way to remove the pale effect from the NSStatusBarButton. This is a picture of how it currently looks:

This is how it should look:

After looking at Apple's documentation, I found a solution to the problem. If you set the appearance of the button directly (e.g. Aqua or DarkAqua), the pale effect disappears:
if let button = statusBarItem.button {
...
button.appearance = NSAppearance.current // or aqua / darkAqua
}
But the problem is when the user changes the interface theme (e.g. from dark mode to light mode), the NSStatusBarButton does not change its appearance automatically:

I could monitor AppleInterfaceThemeChangedNotification and then change the appearance, but that's not a clean solution and I'm not happy with it.
Is there an elegant solution to this? The image in the NSStatusBarButton should simply be displayed without changes (e.g. pale). Because I offer all flags of the world, I only have the images in png format, no PDF images.
Write an extension of
NSStatusBarButtonand overrideviewDidChangeEffectiveAppearance.In the body of the method change the appearance explicitly