Skip to content

Commit 84568c6

Browse files
committed
Add support for dynamic background color in MediathekShowCard and PersistedShowCard based on color scheme
1 parent cfc1c0f commit 84568c6

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

Zapp/Views/MediathekView.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,7 @@ struct SearchSuggestionListView: View {
621621
struct MediathekShowCard: View {
622622
let show: MediathekShow
623623
@EnvironmentObject var repo: MediathekRepository
624+
@Environment(\.colorScheme) private var colorScheme
624625

625626
var body: some View {
626627
VStack(alignment: .leading, spacing: 8) {
@@ -678,9 +679,16 @@ struct MediathekShowCard: View {
678679
}
679680
}
680681
.padding()
681-
.background(Color(.systemBackground))
682+
.background(cardBackground)
682683
.cornerRadius(12)
683684
}
685+
686+
private var cardBackground: Color {
687+
if colorScheme == .dark {
688+
return Color(uiColor: .secondarySystemBackground)
689+
}
690+
return Color(.systemBackground)
691+
}
684692
}
685693

686694
struct FilterView: View {

Zapp/Views/PersonalView.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ struct PersistedShowCard: View {
163163
let allowContinueWatchingDeletion: Bool
164164
let allowBookmarkRemoval: Bool
165165
@EnvironmentObject var repo: MediathekRepository
166+
@Environment(\.colorScheme) private var colorScheme
166167
@State private var showDownloadNotReadyAlert = false
167168
@State private var showDetailsSheet = false
168169

@@ -279,7 +280,7 @@ struct PersistedShowCard: View {
279280
}
280281
}
281282
.padding()
282-
.background(Color(.systemBackground))
283+
.background(cardBackground)
283284
.cornerRadius(12)
284285
.shadow(color: .black.opacity(0.1), radius: 4, x: 0, y: 2)
285286
.onTapGesture {
@@ -454,6 +455,13 @@ struct PersistedShowCard: View {
454455
return String(format: "%d:%02d", minutes, secs)
455456
}
456457
}
458+
459+
private var cardBackground: Color {
460+
if colorScheme == .dark {
461+
return Color(uiColor: .secondarySystemBackground)
462+
}
463+
return Color(.systemBackground)
464+
}
457465
}
458466

459467
struct PersonalView_Previews: PreviewProvider {

0 commit comments

Comments
 (0)