-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add background color to
UsageStackView
- Loading branch information
1 parent
0afe89a
commit 8fca295
Showing
3 changed files
with
39 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import Cocoa | ||
|
||
class UsageStackView: NSStackView { | ||
override func draw(_ dirtyRect: NSRect) { | ||
super.draw(dirtyRect) | ||
|
||
configure() | ||
} | ||
|
||
func configure() { | ||
wantsLayer = true | ||
if #available(OSX 10.14, *) { | ||
self.layer?.backgroundColor = NSColor.alternatingContentBackgroundColors[0].cgColor | ||
} else { | ||
layer?.backgroundColor = NSColor.white.cgColor | ||
} | ||
} | ||
} |