Guest User

Untitled

a guest
Nov 13th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. import Cocoa
  2.  
  3. class CustomWindow: NSWindowController {
  4.  
  5. // This variable will hold our colours
  6. var windowColor = NSColor(named: "WindowColor") {
  7. didSet {
  8. configureWindowAppearance()
  9. }
  10. }
  11.  
  12. override func windowDidLoad() {
  13. super.windowDidLoad()
  14.  
  15. self.configureWindowAppearance()
  16. }
  17.  
  18. private func configureWindowAppearance() {
  19. if let window = window {
  20. if let view = window.contentView {
  21. view.wantsLayer = true
  22.  
  23. window.titlebarAppearsTransparent = true
  24.  
  25. // Instead of .white, we use our variable
  26. window.backgroundColor = windowColor
  27.  
  28. }
  29. }
  30. }
  31. }
Add Comment
Please, Sign In to add comment