Support dark mode for small avatars on iOS
This commit is contained in:
parent
6c55fdd8ec
commit
2ee72125ba
|
@ -51,7 +51,7 @@ private extension RSImage {
|
|||
let rect = CGRect(x: 0, y: 0, width: avatarSize, height: avatarSize)
|
||||
UIGraphicsBeginImageContext(rect.size)
|
||||
if let context = UIGraphicsGetCurrentContext() {
|
||||
context.setFillColor(AppAssets.avatarLightBackgroundColor.cgColor)
|
||||
context.setFillColor(AppAssets.avatarBackgroundColor.cgColor)
|
||||
context.fill(rect)
|
||||
context.translateBy(x: 0.0, y: CGFloat(integerLiteral: avatarSize));
|
||||
context.scaleBy(x: 1.0, y: -1.0)
|
||||
|
|
|
@ -10,14 +10,10 @@ import RSCore
|
|||
|
||||
struct AppAssets {
|
||||
|
||||
static var avatarDarkBackgroundColor: UIColor {
|
||||
return UIColor(named: "avatarDarkBackgroundColor")!
|
||||
}
|
||||
static var avatarBackgroundColor: UIColor = {
|
||||
return UIColor(named: "avatarBackgroundColor")!
|
||||
}()
|
||||
|
||||
static var avatarLightBackgroundColor: UIColor {
|
||||
return UIColor(named: "avatarLightBackgroundColor")!
|
||||
}
|
||||
|
||||
static var circleClosedImage: RSImage = {
|
||||
return RSImage(named: "circleClosedImage")!
|
||||
}()
|
||||
|
|
|
@ -73,6 +73,19 @@ class MasterTimelineViewController: ProgressTableViewController, UndoableCommand
|
|||
}
|
||||
}
|
||||
|
||||
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
|
||||
super.traitCollectionDidChange(previousTraitCollection)
|
||||
|
||||
if traitCollection.userInterfaceStyle != previousTraitCollection?.userInterfaceStyle {
|
||||
appDelegate.authorAvatarDownloader.resetCache()
|
||||
appDelegate.feedIconDownloader.resetCache()
|
||||
appDelegate.faviconDownloader.resetCache()
|
||||
performBlockAndRestoreSelection {
|
||||
tableView.reloadData()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK Actions
|
||||
|
||||
@IBAction func markAllAsRead(_ sender: Any) {
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
},
|
||||
"colors" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"red" : "242",
|
||||
"alpha" : "1.000",
|
||||
"blue" : "242",
|
||||
"green" : "242"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"red" : "56",
|
||||
"alpha" : "1.000",
|
||||
"blue" : "56",
|
||||
"green" : "56"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
{
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
},
|
||||
"colors" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"red" : "56",
|
||||
"alpha" : "1.000",
|
||||
"blue" : "56",
|
||||
"green" : "56"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
{
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
},
|
||||
"colors" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"red" : "242",
|
||||
"alpha" : "1.000",
|
||||
"blue" : "242",
|
||||
"green" : "242"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue