mirror of
https://github.com/yattee/yattee.git
synced 2026-05-12 18:35:05 +00:00
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.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -8,11 +8,16 @@
|
||||
import SwiftUI
|
||||
|
||||
struct HomeShortcutCardView<StatusIndicator: View>: 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<StatusIndicator: View>: 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<StatusIndicator: View>: 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<StatusIndicator: View>: 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<StatusIndicator: View>: 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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,11 +8,17 @@
|
||||
import SwiftUI
|
||||
|
||||
struct HomeShortcutRowView<StatusIndicator: View>: 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<StatusIndicator: View>: View {
|
||||
HStack(spacing: 12) {
|
||||
Image(systemName: icon)
|
||||
.font(.title3)
|
||||
.foregroundStyle(.tint)
|
||||
.foregroundStyle(accentColor)
|
||||
.frame(width: 28)
|
||||
|
||||
VStack(alignment: .leading, spacing: 2) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user