aboutsummaryrefslogtreecommitdiff
path: root/Flat Bezel/BackgroundView.swift
diff options
context:
space:
mode:
authorRuben Beltran del Rio <ruben@unlimited.pizza>2023-02-08 17:25:34 +0100
committerRuben Beltran del Rio <ruben@unlimited.pizza>2023-02-08 17:25:34 +0100
commitfc2c05420021064af5e322f5e59cf0995239349a (patch)
tree18ea7a9d8116cf486b1d39d1885aff80a6484dad /Flat Bezel/BackgroundView.swift
parent5200836d4b4ca9baf0f578f7a462f27d155abff4 (diff)
Port BackgroundView to swift, use system darkmode
Diffstat (limited to 'Flat Bezel/BackgroundView.swift')
-rw-r--r--Flat Bezel/BackgroundView.swift31
1 files changed, 31 insertions, 0 deletions
diff --git a/Flat Bezel/BackgroundView.swift b/Flat Bezel/BackgroundView.swift
new file mode 100644
index 0000000..041874a
--- /dev/null
+++ b/Flat Bezel/BackgroundView.swift
@@ -0,0 +1,31 @@
+//
+// BBBackgroundView.swift
+// Flat Bezel
+//
+// Created by Ruben Beltran del Rio on 2/8/23.
+// Copyright © 2023 BRNBW. All rights reserved.
+//
+
+import Foundation
+import Cocoa
+
+class BackgroundView: QSBezelBackgroundView {
+
+ override func draw(_ rect: NSRect) {
+ let boundsRect = self.bounds
+
+ let roundRect = NSBezierPath()
+ roundRect.appendRoundedRect(boundsRect, xRadius: 8.0, yRadius: 8.0)
+ roundRect.addClip()
+
+ let darkMode = self.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)
+ }
+}