From 37418471bc3f25fc709a8afdbc6602f02156c89e Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Mon, 30 Sep 2019 02:48:51 -0500 Subject: [PATCH] Give large images a background in darkmode when they are dark --- iOS/Inspector/FeedInspectorView.swift | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/iOS/Inspector/FeedInspectorView.swift b/iOS/Inspector/FeedInspectorView.swift index 1b695a0bf..79b22175a 100644 --- a/iOS/Inspector/FeedInspectorView.swift +++ b/iOS/Inspector/FeedInspectorView.swift @@ -24,10 +24,9 @@ struct FeedInspectorView : View { Spacer() if self.viewModel.image.size.width < 32 || self.viewModel.image.size.height < 32 { if colorScheme == .dark && self.viewModel.image.isDark() { - ZStack { - Color(AppAssets.avatarBackgroundColor) - Image(uiImage: self.viewModel.image).resizable() - } + Image(uiImage: self.viewModel.image) + .resizable() + .background(Color(AppAssets.avatarBackgroundColor)) .frame(width: 24.0, height: 24.0) .cornerRadius(2.0) } else { @@ -37,10 +36,18 @@ struct FeedInspectorView : View { .cornerRadius(2.0) } } else { - Image(uiImage: self.viewModel.image) - .resizable() - .frame(width: 48.0, height: 48.0) - .cornerRadius(5.0) + 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 { + Image(uiImage: self.viewModel.image) + .resizable() + .frame(width: 48.0, height: 48.0) + .cornerRadius(5.0) + } } Spacer() }) {