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 {
@ -36,12 +35,20 @@ struct FeedInspectorView : View {
.frame(width: 24.0, height: 24.0) .frame(width: 24.0, height: 24.0)
.cornerRadius(2.0) .cornerRadius(2.0)
} }
} else {
if colorScheme == .dark && self.viewModel.image.isDark() {
Image(uiImage: self.viewModel.image)
.resizable()
.background(Color(AppAssets.avatarBackgroundColor))
.frame(width: 48.0, height: 48.0)
.cornerRadius(5.0)
} else { } else {
Image(uiImage: self.viewModel.image) Image(uiImage: self.viewModel.image)
.resizable() .resizable()
.frame(width: 48.0, height: 48.0) .frame(width: 48.0, height: 48.0)
.cornerRadius(5.0) .cornerRadius(5.0)
} }
}
Spacer() Spacer()
}) { }) {
TextField("Feed Name", text: $viewModel.name) TextField("Feed Name", text: $viewModel.name)