mirror of
https://github.com/yattee/yattee.git
synced 2026-05-13 19:05:03 +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 listStyle: VideoListStyle
|
||||||
let isGroupedMode: Bool
|
let isGroupedMode: Bool
|
||||||
|
|
||||||
|
private var accentColor: Color {
|
||||||
|
appEnvironment?.settingsManager.accentColor.color ?? .accentColor
|
||||||
|
}
|
||||||
|
|
||||||
private var completedFiltered: [Download] {
|
private var completedFiltered: [Download] {
|
||||||
guard !searchText.isEmpty else { return manager.completedDownloads }
|
guard !searchText.isEmpty else { return manager.completedDownloads }
|
||||||
let query = searchText.lowercased()
|
let query = searchText.lowercased()
|
||||||
@@ -502,7 +506,7 @@ private struct CompletedDownloadsSectionContentView: View {
|
|||||||
Image(systemName: "chevron.right")
|
Image(systemName: "chevron.right")
|
||||||
.font(.caption)
|
.font(.caption)
|
||||||
}
|
}
|
||||||
.foregroundStyle(Color.accentColor)
|
.foregroundStyle(accentColor)
|
||||||
}
|
}
|
||||||
.zoomTransitionSource(id: channelID)
|
.zoomTransitionSource(id: channelID)
|
||||||
.buttonStyle(.plain)
|
.buttonStyle(.plain)
|
||||||
|
|||||||
@@ -8,11 +8,16 @@
|
|||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
struct HomeShortcutCardView<StatusIndicator: View>: View {
|
struct HomeShortcutCardView<StatusIndicator: View>: View {
|
||||||
|
@Environment(\.appEnvironment) private var appEnvironment
|
||||||
@Environment(\.dynamicTypeSize) private var dynamicTypeSize
|
@Environment(\.dynamicTypeSize) private var dynamicTypeSize
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
@Environment(\.isFocused) private var isFocused
|
@Environment(\.isFocused) private var isFocused
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
private var accentColor: Color {
|
||||||
|
appEnvironment?.settingsManager.accentColor.color ?? .accentColor
|
||||||
|
}
|
||||||
|
|
||||||
let icon: String
|
let icon: String
|
||||||
let title: String
|
let title: String
|
||||||
let count: Int
|
let count: Int
|
||||||
@@ -76,7 +81,7 @@ struct HomeShortcutCardView<StatusIndicator: View>: View {
|
|||||||
VStack(alignment: .leading, spacing: 8) {
|
VStack(alignment: .leading, spacing: 8) {
|
||||||
Image(systemName: icon)
|
Image(systemName: icon)
|
||||||
.font(.title3)
|
.font(.title3)
|
||||||
.foregroundStyle(.tint)
|
.foregroundStyle(accentColor)
|
||||||
.frame(width: iconSize)
|
.frame(width: iconSize)
|
||||||
|
|
||||||
VStack(alignment: .leading, spacing: 2) {
|
VStack(alignment: .leading, spacing: 2) {
|
||||||
@@ -102,7 +107,7 @@ struct HomeShortcutCardView<StatusIndicator: View>: View {
|
|||||||
HStack(alignment: .center, spacing: 8) {
|
HStack(alignment: .center, spacing: 8) {
|
||||||
Image(systemName: icon)
|
Image(systemName: icon)
|
||||||
.font(.title3)
|
.font(.title3)
|
||||||
.foregroundStyle(.tint)
|
.foregroundStyle(accentColor)
|
||||||
.frame(width: iconSize)
|
.frame(width: iconSize)
|
||||||
|
|
||||||
VStack(alignment: .leading, spacing: 2) {
|
VStack(alignment: .leading, spacing: 2) {
|
||||||
@@ -136,7 +141,7 @@ struct HomeShortcutCardView<StatusIndicator: View>: View {
|
|||||||
.background(cardBackground)
|
.background(cardBackground)
|
||||||
.overlay(
|
.overlay(
|
||||||
RoundedRectangle(cornerRadius: cornerRadius)
|
RoundedRectangle(cornerRadius: cornerRadius)
|
||||||
.strokeBorder(Color.accentColor.opacity(0.3), lineWidth: 1)
|
.strokeBorder(accentColor.opacity(0.3), lineWidth: 1)
|
||||||
)
|
)
|
||||||
.clipShape(RoundedRectangle(cornerRadius: cornerRadius))
|
.clipShape(RoundedRectangle(cornerRadius: cornerRadius))
|
||||||
}
|
}
|
||||||
@@ -159,7 +164,7 @@ struct HomeShortcutCardView<StatusIndicator: View>: View {
|
|||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
isFocused ? Color.white.opacity(0.2) : Color.gray.opacity(0.3)
|
isFocused ? Color.white.opacity(0.2) : Color.gray.opacity(0.3)
|
||||||
#else
|
#else
|
||||||
Color.accentColor.opacity(0.1)
|
accentColor.opacity(0.1)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,11 +8,17 @@
|
|||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
struct HomeShortcutRowView<StatusIndicator: View>: View {
|
struct HomeShortcutRowView<StatusIndicator: View>: View {
|
||||||
|
@Environment(\.appEnvironment) private var appEnvironment
|
||||||
|
|
||||||
let icon: String
|
let icon: String
|
||||||
let title: String
|
let title: String
|
||||||
let subtitle: String
|
let subtitle: String
|
||||||
var statusIndicator: StatusIndicator?
|
var statusIndicator: StatusIndicator?
|
||||||
|
|
||||||
|
private var accentColor: Color {
|
||||||
|
appEnvironment?.settingsManager.accentColor.color ?? .accentColor
|
||||||
|
}
|
||||||
|
|
||||||
init(
|
init(
|
||||||
icon: String,
|
icon: String,
|
||||||
title: String,
|
title: String,
|
||||||
@@ -29,7 +35,7 @@ struct HomeShortcutRowView<StatusIndicator: View>: View {
|
|||||||
HStack(spacing: 12) {
|
HStack(spacing: 12) {
|
||||||
Image(systemName: icon)
|
Image(systemName: icon)
|
||||||
.font(.title3)
|
.font(.title3)
|
||||||
.foregroundStyle(.tint)
|
.foregroundStyle(accentColor)
|
||||||
.frame(width: 28)
|
.frame(width: 28)
|
||||||
|
|
||||||
VStack(alignment: .leading, spacing: 2) {
|
VStack(alignment: .leading, spacing: 2) {
|
||||||
|
|||||||
@@ -33,6 +33,10 @@ struct HomeView: View {
|
|||||||
private var dataManager: DataManager? { appEnvironment?.dataManager }
|
private var dataManager: DataManager? { appEnvironment?.dataManager }
|
||||||
private var settingsManager: SettingsManager? { appEnvironment?.settingsManager }
|
private var settingsManager: SettingsManager? { appEnvironment?.settingsManager }
|
||||||
|
|
||||||
|
private var accentColor: Color {
|
||||||
|
appEnvironment?.settingsManager.accentColor.color ?? .accentColor
|
||||||
|
}
|
||||||
|
|
||||||
#if !os(tvOS)
|
#if !os(tvOS)
|
||||||
private var downloadManager: DownloadManager? { appEnvironment?.downloadManager }
|
private var downloadManager: DownloadManager? { appEnvironment?.downloadManager }
|
||||||
#endif
|
#endif
|
||||||
@@ -273,7 +277,7 @@ struct HomeView: View {
|
|||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
Text(title)
|
Text(title)
|
||||||
.fontWeight(.semibold)
|
.fontWeight(.semibold)
|
||||||
.foregroundStyle(Color.accentColor)
|
.foregroundStyle(accentColor)
|
||||||
#else
|
#else
|
||||||
Button(action: action) {
|
Button(action: action) {
|
||||||
HStack(spacing: 4) {
|
HStack(spacing: 4) {
|
||||||
@@ -282,7 +286,7 @@ struct HomeView: View {
|
|||||||
Image(systemName: "chevron.right")
|
Image(systemName: "chevron.right")
|
||||||
.font(.caption)
|
.font(.caption)
|
||||||
}
|
}
|
||||||
.foregroundStyle(Color.accentColor)
|
.foregroundStyle(accentColor)
|
||||||
}
|
}
|
||||||
.buttonStyle(.plain)
|
.buttonStyle(.plain)
|
||||||
#endif
|
#endif
|
||||||
@@ -1291,7 +1295,7 @@ struct HomeView: View {
|
|||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
Text(verbatim: "\(contentType.localizedTitle) - \(instance.displayName)")
|
Text(verbatim: "\(contentType.localizedTitle) - \(instance.displayName)")
|
||||||
.fontWeight(.semibold)
|
.fontWeight(.semibold)
|
||||||
.foregroundStyle(Color.accentColor)
|
.foregroundStyle(accentColor)
|
||||||
#else
|
#else
|
||||||
Button {
|
Button {
|
||||||
appEnvironment?.navigationCoordinator.navigate(
|
appEnvironment?.navigationCoordinator.navigate(
|
||||||
@@ -1304,7 +1308,7 @@ struct HomeView: View {
|
|||||||
Image(systemName: "chevron.right")
|
Image(systemName: "chevron.right")
|
||||||
.font(.caption)
|
.font(.caption)
|
||||||
}
|
}
|
||||||
.foregroundStyle(Color.accentColor)
|
.foregroundStyle(accentColor)
|
||||||
}
|
}
|
||||||
.buttonStyle(.plain)
|
.buttonStyle(.plain)
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1129,7 +1129,7 @@ struct SubscriptionsView: View {
|
|||||||
Image(systemName: "chevron.right")
|
Image(systemName: "chevron.right")
|
||||||
.font(.caption)
|
.font(.caption)
|
||||||
}
|
}
|
||||||
.foregroundStyle(Color.accentColor)
|
.foregroundStyle(accentColor)
|
||||||
}
|
}
|
||||||
.buttonStyle(.plain)
|
.buttonStyle(.plain)
|
||||||
} else {
|
} else {
|
||||||
@@ -1140,7 +1140,7 @@ struct SubscriptionsView: View {
|
|||||||
Image(systemName: "chevron.right")
|
Image(systemName: "chevron.right")
|
||||||
.font(.caption)
|
.font(.caption)
|
||||||
}
|
}
|
||||||
.foregroundStyle(Color.accentColor)
|
.foregroundStyle(accentColor)
|
||||||
}
|
}
|
||||||
.buttonStyle(.plain)
|
.buttonStyle(.plain)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user