Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Cocoa
- class CustomWindow: NSWindowController {
- // This variable will hold our colours
- var windowColor = NSColor(named: "WindowColor") {
- didSet {
- configureWindowAppearance()
- }
- }
- override func windowDidLoad() {
- super.windowDidLoad()
- self.configureWindowAppearance()
- }
- private func configureWindowAppearance() {
- if let window = window {
- if let view = window.contentView {
- view.wantsLayer = true
- window.titlebarAppearsTransparent = true
- // Instead of .white, we use our variable
- window.backgroundColor = windowColor
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment