Add position-based colorful Home shortcut palettes

Colorful shortcut cards now color by grid position instead of shortcut
identity, so colors stay in the same slot when shortcuts are reordered.

Adds a Palette option (Classic default, plus Sunset, Meadow, Berry,
Grape) and a Custom palette with a swatch-list editor (ColorPicker + hex
fields) and a switchable comma-separated text field. Color is resolved
per position and wraps by palette length, wired via a new
homeShortcutColorfulColor environment value and a Color(hex:) extension.
This commit is contained in:
Arkadiusz Fal
2026-05-28 23:26:05 +02:00
parent bcd4206c55
commit 486024834d
10 changed files with 596 additions and 51 deletions

View File

@@ -13,6 +13,8 @@ struct HomeSettingsView: View {
// Local state for editing (copied from settings on appear, saved on dismiss)
@State private var shortcutLayout: HomeShortcutLayout = .cards
@State private var shortcutCardStyle: HomeShortcutCardStyle = .plain
@State private var shortcutColorfulPalette: HomeShortcutColorfulPalette = .classic
@State private var shortcutCustomPaletteColors: [String] = []
@State private var shortcutOrder: [HomeShortcutItem] = []
@State private var shortcutVisibility: [HomeShortcutItem: Bool] = [:]
@State private var sectionOrder: [HomeSectionItem] = []
@@ -54,7 +56,11 @@ struct HomeSettingsView: View {
#if os(macOS)
.listStyle(.inset)
.navigationDestination(isPresented: $showingStyleSettings) {
HomeShortcutStyleView(style: $shortcutCardStyle)
HomeShortcutStyleView(
style: $shortcutCardStyle,
palette: $shortcutColorfulPalette,
customColors: $shortcutCustomPaletteColors
)
}
#endif
#if !os(tvOS)
@@ -111,7 +117,11 @@ struct HomeSettingsView: View {
systemImage: "paintpalette",
trailing: { Text(shortcutCardStyle.displayName) }
) {
HomeShortcutStyleView(style: $shortcutCardStyle)
HomeShortcutStyleView(
style: $shortcutCardStyle,
palette: $shortcutColorfulPalette,
customColors: $shortcutCustomPaletteColors
)
}
#endif
}
@@ -311,6 +321,8 @@ struct HomeSettingsView: View {
shortcutLayout = settings.homeShortcutLayout
shortcutCardStyle = settings.homeShortcutCardStyle
shortcutColorfulPalette = settings.homeShortcutColorfulPalette
shortcutCustomPaletteColors = settings.homeShortcutCustomPaletteColors
shortcutOrder = settings.homeShortcutOrder
shortcutVisibility = settings.homeShortcutVisibility
sectionOrder = settings.homeSectionOrder
@@ -332,6 +344,8 @@ struct HomeSettingsView: View {
guard let settings = settingsManager else { return }
settings.homeShortcutLayout = shortcutLayout
settings.homeShortcutCardStyle = shortcutCardStyle
settings.homeShortcutColorfulPalette = shortcutColorfulPalette
settings.homeShortcutCustomPaletteColors = shortcutCustomPaletteColors
settings.homeShortcutOrder = shortcutOrder
settings.homeShortcutVisibility = shortcutVisibility
settings.homeSectionOrder = sectionOrder