title: NSPopover Background Color (Including Triangle) with macOS Mojave Dark Mode
body: <p><em>Swift 4.2, Xcode 10, macOS 10.14</em></p>
  
  <p>I have created the following <code>NSView</code> subclass that I put on the root view of all my <code>NSPopover</code> instances in my storyboard. But I noticed that when I switch the color mode in macOS Mojave (from dark to light or the other way around) that it doesn't update the background color of my <code>NSPopover</code>.</p>
  
  <pre><code>class PopoverMain:NSView{
    override func viewDidMoveToWindow() {
      guard let frameView = window?.contentView?.superview else { return }
  
      let backgroundView = NSView(frame: frameView.bounds)
      backgroundView.backgroundColor(color: Color(named: "MyColor")!)
      backgroundView.autoresizingMask = [.width, .height]
  
      frameView.addSubview(backgroundView, positioned: .below, relativeTo: frameView)
    }
  }
  </code></pre>
  
  <p>I believe this is because a color mode transition only calls these methods (<a href="https://developer.apple.com/documentation/appkit/supporting_dark_mode_in_your_interface" rel="nofollow noreferrer">source</a>) and <strong>not</strong> <code>viewDidMoveToWindow()</code>:</p>
  
  <ul>
  <li><code>updateLayer()</code></li>
  <li><code>draw(_:)</code></li>
  <li><code>layout()</code></li>
  <li><code>updateConstraints()</code></li>
  </ul>
  
  <p>Has anyone figured out a reliable way to color the background of an <code>NSPopover</code> (including its triangle) and have it work seamlessly on macOS Mojave?</p>