From df91db9c681175a4fa9154f924ae6ccc3a424540 Mon Sep 17 00:00:00 2001 From: Daniel Barber Date: Fri, 11 Oct 2019 17:05:52 -0400 Subject: [PATCH] Improve album art display * Mask album art to rounded corners * Add a black background colour for albums with non square artwork --- .../Browser/Album Browser/AlbumViewItem.swift | 4 +++- .../Browser/Album Detail/AlbumDetailView.swift | 10 +++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Persephone/Components/Browser/Album Browser/AlbumViewItem.swift b/Persephone/Components/Browser/Album Browser/AlbumViewItem.swift index 18643ff..4922516 100644 --- a/Persephone/Components/Browser/Album Browser/AlbumViewItem.swift +++ b/Persephone/Components/Browser/Album Browser/AlbumViewItem.swift @@ -22,8 +22,10 @@ class AlbumViewItem: NSCollectionViewItem { super.viewDidLoad() albumCoverView.wantsLayer = true - albumCoverView.layer?.cornerRadius = 3 + albumCoverView.layer?.backgroundColor = NSColor.black.cgColor + albumCoverView.layer?.cornerRadius = 4 albumCoverView.layer?.borderWidth = 1 + albumCoverView.layer?.masksToBounds = true albumCoverBox.wantsLayer = true albumCoverBox.layer?.cornerRadius = 5 diff --git a/Persephone/Components/Browser/Album Detail/AlbumDetailView.swift b/Persephone/Components/Browser/Album Detail/AlbumDetailView.swift index 94e4b72..8b99cf2 100644 --- a/Persephone/Components/Browser/Album Detail/AlbumDetailView.swift +++ b/Persephone/Components/Browser/Album Detail/AlbumDetailView.swift @@ -9,6 +9,7 @@ import AppKit class AlbumDetailView: NSViewController { + var observer: NSKeyValueObservation? var album: Album? var dataSource = AlbumTracksDataSource() @@ -30,10 +31,17 @@ class AlbumDetailView: NSViewController { albumTracksView.columnAutoresizingStyle = .sequentialColumnAutoresizingStyle albumCoverView.wantsLayer = true - albumCoverView.layer?.cornerRadius = 5 + albumCoverView.layer?.backgroundColor = NSColor.black.cgColor + albumCoverView.layer?.cornerRadius = 6 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() {