Added image luminescence processing to IconView so that pure white feed icons are visible. Issue #1731

This commit is contained in:
Maurice Parker 2020-03-14 17:19:06 -05:00
parent 5b5eaf6bb7
commit cba00b6d45
1 changed files with 18 additions and 1 deletions

View File

@ -14,12 +14,29 @@ final class IconView: NSView {
didSet {
if iconImage !== oldValue {
imageView.image = iconImage?.image
if NSApplication.shared.effectiveAppearance.isDarkMode {
if self.iconImage?.isDark ?? false {
self.isDisconcernable = false
} else {
self.isDisconcernable = true
}
} else {
if self.iconImage?.isBright ?? false {
self.isDisconcernable = false
} else {
self.isDisconcernable = true
}
}
needsDisplay = true
needsLayout = true
}
}
}
private var isDisconcernable = true
override var isFlipped: Bool {
return true
}
@ -67,7 +84,7 @@ final class IconView: NSView {
}
override func draw(_ dirtyRect: NSRect) {
guard hasExposedVerticalBackground else {
guard hasExposedVerticalBackground || !isDisconcernable else {
return
}