From 6df80c0e793762e27092c437f7943f6ecc221960 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Thu, 23 Apr 2026 22:55:48 +0200 Subject: [PATCH] Use user-selected accent color in Home, Subscriptions, and Downloads Color.accentColor and .foregroundStyle(.tint) resolve to the asset catalog accent on macOS, so Home shortcut cards, section header links, the Subscriptions "All channels" header, and the Downloads per-channel group headers stayed blue when the user picked a different accent. Read the color from SettingsManager and apply it directly, matching the pattern already used for the Play button. --- Yattee/Views/Downloads/DownloadsView.swift | 6 +++++- Yattee/Views/Home/HomeShortcutCardView.swift | 13 +++++++++---- Yattee/Views/Home/HomeShortcutRowView.swift | 8 +++++++- Yattee/Views/Home/HomeView.swift | 12 ++++++++---- Yattee/Views/Subscriptions/SubscriptionsView.swift | 4 ++-- 5 files changed, 31 insertions(+), 12 deletions(-) diff --git a/Yattee/Views/Downloads/DownloadsView.swift b/Yattee/Views/Downloads/DownloadsView.swift index e4b2b1e1..bdb1cb53 100644 --- a/Yattee/Views/Downloads/DownloadsView.swift +++ b/Yattee/Views/Downloads/DownloadsView.swift @@ -347,6 +347,10 @@ private struct CompletedDownloadsSectionContentView: View { let listStyle: VideoListStyle let isGroupedMode: Bool + private var accentColor: Color { + appEnvironment?.settingsManager.accentColor.color ?? .accentColor + } + private var completedFiltered: [Download] { guard !searchText.isEmpty else { return manager.completedDownloads } let query = searchText.lowercased() @@ -502,7 +506,7 @@ private struct CompletedDownloadsSectionContentView: View { Image(systemName: "chevron.right") .font(.caption) } - .foregroundStyle(Color.accentColor) + .foregroundStyle(accentColor) } .zoomTransitionSource(id: channelID) .buttonStyle(.plain) diff --git a/Yattee/Views/Home/HomeShortcutCardView.swift b/Yattee/Views/Home/HomeShortcutCardView.swift index 365074cb..4055956b 100644 --- a/Yattee/Views/Home/HomeShortcutCardView.swift +++ b/Yattee/Views/Home/HomeShortcutCardView.swift @@ -8,11 +8,16 @@ import SwiftUI struct HomeShortcutCardView: View { + @Environment(\.appEnvironment) private var appEnvironment @Environment(\.dynamicTypeSize) private var dynamicTypeSize #if os(tvOS) @Environment(\.isFocused) private var isFocused #endif + private var accentColor: Color { + appEnvironment?.settingsManager.accentColor.color ?? .accentColor + } + let icon: String let title: String let count: Int @@ -76,7 +81,7 @@ struct HomeShortcutCardView: View { VStack(alignment: .leading, spacing: 8) { Image(systemName: icon) .font(.title3) - .foregroundStyle(.tint) + .foregroundStyle(accentColor) .frame(width: iconSize) VStack(alignment: .leading, spacing: 2) { @@ -102,7 +107,7 @@ struct HomeShortcutCardView: View { HStack(alignment: .center, spacing: 8) { Image(systemName: icon) .font(.title3) - .foregroundStyle(.tint) + .foregroundStyle(accentColor) .frame(width: iconSize) VStack(alignment: .leading, spacing: 2) { @@ -136,7 +141,7 @@ struct HomeShortcutCardView: View { .background(cardBackground) .overlay( RoundedRectangle(cornerRadius: cornerRadius) - .strokeBorder(Color.accentColor.opacity(0.3), lineWidth: 1) + .strokeBorder(accentColor.opacity(0.3), lineWidth: 1) ) .clipShape(RoundedRectangle(cornerRadius: cornerRadius)) } @@ -159,7 +164,7 @@ struct HomeShortcutCardView: View { #if os(tvOS) isFocused ? Color.white.opacity(0.2) : Color.gray.opacity(0.3) #else - Color.accentColor.opacity(0.1) + accentColor.opacity(0.1) #endif } } diff --git a/Yattee/Views/Home/HomeShortcutRowView.swift b/Yattee/Views/Home/HomeShortcutRowView.swift index 71608315..c8367029 100644 --- a/Yattee/Views/Home/HomeShortcutRowView.swift +++ b/Yattee/Views/Home/HomeShortcutRowView.swift @@ -8,11 +8,17 @@ import SwiftUI struct HomeShortcutRowView: View { + @Environment(\.appEnvironment) private var appEnvironment + let icon: String let title: String let subtitle: String var statusIndicator: StatusIndicator? + private var accentColor: Color { + appEnvironment?.settingsManager.accentColor.color ?? .accentColor + } + init( icon: String, title: String, @@ -29,7 +35,7 @@ struct HomeShortcutRowView: View { HStack(spacing: 12) { Image(systemName: icon) .font(.title3) - .foregroundStyle(.tint) + .foregroundStyle(accentColor) .frame(width: 28) VStack(alignment: .leading, spacing: 2) { diff --git a/Yattee/Views/Home/HomeView.swift b/Yattee/Views/Home/HomeView.swift index 649795e9..626950b6 100644 --- a/Yattee/Views/Home/HomeView.swift +++ b/Yattee/Views/Home/HomeView.swift @@ -33,6 +33,10 @@ struct HomeView: View { private var dataManager: DataManager? { appEnvironment?.dataManager } private var settingsManager: SettingsManager? { appEnvironment?.settingsManager } + private var accentColor: Color { + appEnvironment?.settingsManager.accentColor.color ?? .accentColor + } + #if !os(tvOS) private var downloadManager: DownloadManager? { appEnvironment?.downloadManager } #endif @@ -273,7 +277,7 @@ struct HomeView: View { #if os(tvOS) Text(title) .fontWeight(.semibold) - .foregroundStyle(Color.accentColor) + .foregroundStyle(accentColor) #else Button(action: action) { HStack(spacing: 4) { @@ -282,7 +286,7 @@ struct HomeView: View { Image(systemName: "chevron.right") .font(.caption) } - .foregroundStyle(Color.accentColor) + .foregroundStyle(accentColor) } .buttonStyle(.plain) #endif @@ -1291,7 +1295,7 @@ struct HomeView: View { #if os(tvOS) Text(verbatim: "\(contentType.localizedTitle) - \(instance.displayName)") .fontWeight(.semibold) - .foregroundStyle(Color.accentColor) + .foregroundStyle(accentColor) #else Button { appEnvironment?.navigationCoordinator.navigate( @@ -1304,7 +1308,7 @@ struct HomeView: View { Image(systemName: "chevron.right") .font(.caption) } - .foregroundStyle(Color.accentColor) + .foregroundStyle(accentColor) } .buttonStyle(.plain) #endif diff --git a/Yattee/Views/Subscriptions/SubscriptionsView.swift b/Yattee/Views/Subscriptions/SubscriptionsView.swift index c08054bb..8458ecfd 100644 --- a/Yattee/Views/Subscriptions/SubscriptionsView.swift +++ b/Yattee/Views/Subscriptions/SubscriptionsView.swift @@ -1129,7 +1129,7 @@ struct SubscriptionsView: View { Image(systemName: "chevron.right") .font(.caption) } - .foregroundStyle(Color.accentColor) + .foregroundStyle(accentColor) } .buttonStyle(.plain) } else { @@ -1140,7 +1140,7 @@ struct SubscriptionsView: View { Image(systemName: "chevron.right") .font(.caption) } - .foregroundStyle(Color.accentColor) + .foregroundStyle(accentColor) } .buttonStyle(.plain) }