Give large images a background in darkmode when they are dark

This commit is contained in:
Maurice Parker 2019-09-30 02:48:51 -05:00
parent 8d0bfd9b47
commit 37418471bc
1 changed files with 15 additions and 8 deletions

View File

@ -24,10 +24,9 @@ struct FeedInspectorView : View {
Spacer() Spacer()
if self.viewModel.image.size.width < 32 || self.viewModel.image.size.height < 32 { if self.viewModel.image.size.width < 32 || self.viewModel.image.size.height < 32 {
if colorScheme == .dark && self.viewModel.image.isDark() { if colorScheme == .dark && self.viewModel.image.isDark() {
ZStack { Image(uiImage: self.viewModel.image)
Color(AppAssets.avatarBackgroundColor) .resizable()
Image(uiImage: self.viewModel.image).resizable() .background(Color(AppAssets.avatarBackgroundColor))
}
.frame(width: 24.0, height: 24.0) .frame(width: 24.0, height: 24.0)
.cornerRadius(2.0) .cornerRadius(2.0)
} else { } else {
@ -37,10 +36,18 @@ struct FeedInspectorView : View {
.cornerRadius(2.0) .cornerRadius(2.0)
} }
} else { } else {
Image(uiImage: self.viewModel.image) if colorScheme == .dark && self.viewModel.image.isDark() {
.resizable() Image(uiImage: self.viewModel.image)
.frame(width: 48.0, height: 48.0) .resizable()
.cornerRadius(5.0) .background(Color(AppAssets.avatarBackgroundColor))
.frame(width: 48.0, height: 48.0)
.cornerRadius(5.0)
} else {
Image(uiImage: self.viewModel.image)
.resizable()
.frame(width: 48.0, height: 48.0)
.cornerRadius(5.0)
}
} }
Spacer() Spacer()
}) { }) {