I've got this cute little program (default Xcode Mac app, with this as the ViewController.swift):
import Cocoa
class ViewController: NSViewController {
@IBOutlet var button: NSButton!
@IBAction func clicked(_ sender: Any) {
if button.contentFilters.isEmpty {
button.contentFilters = [CIFilter(name: "CIGaussianBlur",
parameters: ["inputRadius": 1])!]
} else {
button.contentFilters = []
}
}
}
The Main.storyboard has just one button, and it's hooked up to both the IBOutlet and IBAction here. When you click it, it turns blurry.
In Mojave's dark mode, though, toggling this also changes the entire style of the window. It becomes even darker, and less transparent.
Why? Is there a way to stop this? I want to continue to use contentFilters, but I don't want changing one little view to change the look of the whole window.
It seems that setting any non-empty contentFilters
, on any NSView anywhere in the window, changes the whole window. I really have no idea what to try, or why this might be happening. I'm not even sure what words to use to describe what's happening to the window!
Normal button in a window in dark mode: https://i.stack.imgur.com/g5Jw8.jpg -- note how it's slightly yellow, since it's sitting on a yellow desktop background.
Blurred button in a window in dark mode: https://i.stack.imgur.com/lAPnv.jpg -- note it's darker, and a different color, because it's not blurring with the background.
Is there any way to stop this from happening? Or at least turn it on permanently, so changing contentFilters doesn't mess up everything?