aboutsummaryrefslogtreecommitdiff
path: root/Flat Bezel/BackgroundView.swift
blob: 789079808cd74988bd5cc2d59943a9670a3bf895 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import Foundation
import Cocoa

class BackgroundView: QSBezelBackgroundView {
  
  override func draw(_ rect: NSRect) {
    let boundsRect = bounds
    
    let roundRect = NSBezierPath()
    roundRect.appendRoundedRect(boundsRect, xRadius: 8.0, yRadius: 8.0)
    roundRect.addClip()
    
    let darkMode = effectiveAppearance.name == .darkAqua
    if (darkMode) {
      NSColor(red: 0.1, green: 0.1, blue: 0.1, alpha: 0.99).setFill()
    } else {
      NSColor(red: 1, green: 1, blue: 1, alpha: 0.99).setFill()
    }
    boundsRect.fill(using: .copy)
    
    super.draw(boundsRect)
  }
}