diff --git a/Mac/AppAssets.swift b/Mac/AppAssets.swift index b9f702e03..f1273b43e 100644 --- a/Mac/AppAssets.swift +++ b/Mac/AppAssets.swift @@ -10,11 +10,6 @@ import AppKit import RSCore import Account -extension NSImage.Name { - static let star = NSImage.Name("star") - static let timelineStar = NSImage.Name("timelineStar") -} - struct AppAssets { static var accountCloudKit: RSImage! = { @@ -133,8 +128,12 @@ struct AppAssets { return IconImage(RSImage(named: NSImage.smartBadgeTemplateName)!) }() - static var timelineStar: RSImage! = { - return RSImage(named: .timelineStar) + static var timelineStarSelected: RSImage! = { + return RSImage(named: "timelineStar")?.tinted(with: .white) + }() + + static var timelineStarUnselected: RSImage! = { + return RSImage(named: "timelineStar")?.tinted(with: starColor) }() static var todayFeedImage: IconImage = { @@ -161,8 +160,8 @@ struct AppAssets { return RSImage(named: "swipeMarkUnstarred")! }() - static var swipeMarkUnstarredColor: NSColor = { - return NSColor(named: NSColor.Name("swipeMarkUnstarredColor"))! + static var starColor: NSColor = { + return NSColor(named: NSColor.Name("starColor"))! }() static func image(for accountType: AccountType) -> NSImage? { diff --git a/Mac/MainWindow/Timeline/Cell/TimelineTableCellView.swift b/Mac/MainWindow/Timeline/Cell/TimelineTableCellView.swift index 9c5be0c19..63e36730c 100644 --- a/Mac/MainWindow/Timeline/Cell/TimelineTableCellView.swift +++ b/Mac/MainWindow/Timeline/Cell/TimelineTableCellView.swift @@ -20,7 +20,7 @@ class TimelineTableCellView: NSTableCellView { private lazy var iconView = IconView() - private let starView = TimelineTableCellView.imageView(with: AppAssets.timelineStar, scaling: .scaleNone) + private var starView = TimelineTableCellView.imageView(with: AppAssets.timelineStarUnselected, scaling: .scaleNone) private let separatorView = TimelineTableCellView.separatorView() private lazy var textFields = { @@ -52,12 +52,14 @@ class TimelineTableCellView: NSTableCellView { var isEmphasized: Bool = false { didSet { unreadIndicatorView.isEmphasized = isEmphasized + updateStarView() } } var isSelected: Bool = false { didSet { unreadIndicatorView.isSelected = isSelected + updateStarView() } } @@ -279,6 +281,11 @@ private extension TimelineTableCellView { } func updateStarView() { + if isSelected && isEmphasized { + starView.image = AppAssets.timelineStarSelected + } else { + starView.image = AppAssets.timelineStarUnselected + } showOrHideView(starView, !cellData.starred) } diff --git a/Mac/MainWindow/Timeline/TimelineViewController.swift b/Mac/MainWindow/Timeline/TimelineViewController.swift index 4f9110c3f..a73a34495 100644 --- a/Mac/MainWindow/Timeline/TimelineViewController.swift +++ b/Mac/MainWindow/Timeline/TimelineViewController.swift @@ -910,7 +910,7 @@ extension TimelineViewController: NSTableViewDelegate { self.toggleArticleStarred(article); tableView.rowActionsVisible = false } - action.backgroundColor = AppAssets.swipeMarkUnstarredColor + action.backgroundColor = AppAssets.starColor action.image = article.status.starred ? AppAssets.swipeMarkUnstarredImage : AppAssets.swipeMarkStarredImage return [action] diff --git a/Mac/Resources/Assets.xcassets/Contents.json b/Mac/Resources/Assets.xcassets/Contents.json index da4a164c9..73c00596a 100644 --- a/Mac/Resources/Assets.xcassets/Contents.json +++ b/Mac/Resources/Assets.xcassets/Contents.json @@ -1,6 +1,6 @@ { "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 } -} \ No newline at end of file +} diff --git a/Mac/Resources/Assets.xcassets/swipeMarkUnstarredColor.colorset/Contents.json b/Mac/Resources/Assets.xcassets/starColor.colorset/Contents.json similarity index 100% rename from Mac/Resources/Assets.xcassets/swipeMarkUnstarredColor.colorset/Contents.json rename to Mac/Resources/Assets.xcassets/starColor.colorset/Contents.json diff --git a/Mac/Resources/Assets.xcassets/timelineStar.imageset/Contents.json b/Mac/Resources/Assets.xcassets/timelineStar.imageset/Contents.json index 838695523..bbb83a141 100644 --- a/Mac/Resources/Assets.xcassets/timelineStar.imageset/Contents.json +++ b/Mac/Resources/Assets.xcassets/timelineStar.imageset/Contents.json @@ -1,13 +1,13 @@ { "images" : [ { + "filename" : "star.pdf", "idiom" : "universal", - "filename" : "timelineStar.png", "scale" : "1x" }, { + "filename" : "star@2x.pdf", "idiom" : "universal", - "filename" : "timelineStar@2x.png", "scale" : "2x" }, { @@ -16,7 +16,11 @@ } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true, + "template-rendering-intent" : "template" } -} \ No newline at end of file +} diff --git a/Mac/Resources/Assets.xcassets/timelineStar.imageset/star.pdf b/Mac/Resources/Assets.xcassets/timelineStar.imageset/star.pdf new file mode 100644 index 000000000..38512296f Binary files /dev/null and b/Mac/Resources/Assets.xcassets/timelineStar.imageset/star.pdf differ diff --git a/Mac/Resources/Assets.xcassets/timelineStar.imageset/star@2x.pdf b/Mac/Resources/Assets.xcassets/timelineStar.imageset/star@2x.pdf new file mode 100644 index 000000000..7fae93def Binary files /dev/null and b/Mac/Resources/Assets.xcassets/timelineStar.imageset/star@2x.pdf differ diff --git a/Mac/Resources/Assets.xcassets/timelineStar.imageset/timelineStar.png b/Mac/Resources/Assets.xcassets/timelineStar.imageset/timelineStar.png deleted file mode 100644 index e74ff38f6..000000000 Binary files a/Mac/Resources/Assets.xcassets/timelineStar.imageset/timelineStar.png and /dev/null differ diff --git a/Mac/Resources/Assets.xcassets/timelineStar.imageset/timelineStar@2x.png b/Mac/Resources/Assets.xcassets/timelineStar.imageset/timelineStar@2x.png deleted file mode 100644 index 31a6f6574..000000000 Binary files a/Mac/Resources/Assets.xcassets/timelineStar.imageset/timelineStar@2x.png and /dev/null differ