mirror of
https://github.com/danbee/persephone
synced 2025-03-04 08:39:11 +00:00
Compare commits
No commits in common. "9f8f3a6ecfd5ebaaa20addec730da6cbf5c9b6f7" and "7d0c50a8b71fcc25ae3adee08a8ab4347e2b7b80" have entirely different histories.
9f8f3a6ecf
...
7d0c50a8b7
@ -14,7 +14,7 @@ class AlbumViewItem: NSCollectionViewItem {
|
||||
|
||||
override var isSelected: Bool {
|
||||
didSet {
|
||||
setAppearance(selected: isSelected)
|
||||
albumCoverBox.layer?.borderWidth = isSelected ? 5 : 0
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,20 +22,18 @@ class AlbumViewItem: NSCollectionViewItem {
|
||||
super.viewDidLoad()
|
||||
|
||||
albumCoverView.wantsLayer = true
|
||||
albumCoverView.layer?.backgroundColor = NSColor.black.cgColor
|
||||
albumCoverView.layer?.cornerRadius = 4
|
||||
albumCoverView.layer?.cornerRadius = 3
|
||||
albumCoverView.layer?.borderWidth = 1
|
||||
albumCoverView.layer?.masksToBounds = true
|
||||
|
||||
albumCoverBox.wantsLayer = true
|
||||
albumCoverBox.layer?.cornerRadius = 7
|
||||
albumCoverBox.layer?.borderWidth = 5
|
||||
albumCoverBox.layer?.cornerRadius = 5
|
||||
albumCoverBox.layer?.borderWidth = 0
|
||||
|
||||
setAppearance(selected: false)
|
||||
setAppearance()
|
||||
|
||||
if #available(OSX 10.14, *) {
|
||||
observer = NSApp.observe(\.effectiveAppearance) { (app, _) in
|
||||
self.setAppearance(selected: false)
|
||||
self.setAppearance()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -59,22 +57,16 @@ class AlbumViewItem: NSCollectionViewItem {
|
||||
}
|
||||
}
|
||||
|
||||
func setAppearance(selected isSelected: Bool) {
|
||||
guard let viewLayer = albumCoverView.layer,
|
||||
let boxLayer = albumCoverBox.layer
|
||||
else { return }
|
||||
|
||||
func setAppearance() {
|
||||
if #available(OSX 10.14, *) {
|
||||
let darkMode = NSApp.effectiveAppearance.bestMatch(from:
|
||||
[.darkAqua, .aqua]) == .darkAqua
|
||||
|
||||
viewLayer.borderColor = darkMode ? .albumBorderColorDark : .albumBorderColorLight
|
||||
boxLayer.borderColor = isSelected ? NSColor.controlAccentColor.cgColor : CGColor.clear
|
||||
boxLayer.backgroundColor = albumCoverBox.layer?.borderColor
|
||||
albumCoverView.layer?.borderColor = darkMode ? .albumBorderColorDark : .albumBorderColorLight
|
||||
albumCoverBox.layer?.borderColor = NSColor.controlAccentColor.cgColor
|
||||
} else {
|
||||
viewLayer.borderColor = .albumBorderColorLight
|
||||
boxLayer.borderColor = isSelected ? NSColor.selectedControlColor.cgColor : CGColor.clear
|
||||
boxLayer.backgroundColor = albumCoverBox.layer?.borderColor
|
||||
albumCoverView.layer?.borderColor = .albumBorderColorLight
|
||||
albumCoverBox.layer?.borderColor = NSColor.selectedControlColor.cgColor
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -9,7 +9,6 @@
|
||||
import AppKit
|
||||
|
||||
class AlbumDetailView: NSViewController {
|
||||
var observer: NSKeyValueObservation?
|
||||
var album: Album?
|
||||
var dataSource = AlbumTracksDataSource()
|
||||
|
||||
@ -31,17 +30,10 @@ class AlbumDetailView: NSViewController {
|
||||
albumTracksView.columnAutoresizingStyle = .sequentialColumnAutoresizingStyle
|
||||
|
||||
albumCoverView.wantsLayer = true
|
||||
albumCoverView.layer?.backgroundColor = NSColor.black.cgColor
|
||||
albumCoverView.layer?.cornerRadius = 6
|
||||
albumCoverView.layer?.cornerRadius = 5
|
||||
albumCoverView.layer?.borderWidth = 1
|
||||
albumCoverView.layer?.masksToBounds = true
|
||||
setAppearance()
|
||||
|
||||
if #available(OSX 10.14, *) {
|
||||
observer = NSApp.observe(\.effectiveAppearance) { (app, _) in
|
||||
self.setAppearance()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override func viewWillAppear() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user