Files
Reflect/Shared/Views/CustomizeView/SubViews/ThemePickerView.swift
Trey t bea2d3bbc9 Update Neon colors and show color circles in theme picker
- Update NeonMoodTint to use synthwave colors matching Neon voting style
  (cyan, lime, yellow, orange, magenta)
- Replace text label with 5 color circles in theme preview Colors row
- Remove unused textColor customization code and picker views
- Add .id(moodTint) to Month/Year views for color refresh
- Clean up various unused color-related code

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 00:08:01 -06:00

83 lines
2.4 KiB
Swift

//
// ThemePicker.swift
// Feels (iOS)
//
// Created by Trey Tartt on 4/2/22.
//
import SwiftUI
struct ThemePickerView: View {
@Environment(\.colorScheme) var colorScheme
@State private var selectedTheme: Theme = UserDefaultsStore.theme()
private var textColor: Color { selectedTheme.currentTheme.labelColor }
var body: some View {
ZStack {
selectedTheme.currentTheme.secondaryBGColor
VStack {
HStack(spacing: 0) {
themeButton(for: .system)
themeButton(for: .iFeel)
themeButton(for: .dark)
themeButton(for: .light)
}
.padding(.top)
}
.padding()
}
.fixedSize(horizontal: false, vertical: true)
.cornerRadius(Constants.viewsCornerRaidus, corners: [.topLeft, .topRight, .bottomLeft, .bottomRight])
.onAppear {
selectedTheme = UserDefaultsStore.theme()
}
}
@ViewBuilder
private func themeButton(for theme: Theme) -> some View {
Button {
selectTheme(theme)
} label: {
VStack {
theme.currentTheme.preview
.allowsHitTesting(false)
.overlay(
Circle()
.stroke(Color(UIColor.systemGray), style: StrokeStyle(lineWidth: 2))
)
Text(theme.title)
.foregroundColor(textColor)
.font(.body)
}
.frame(maxWidth: .infinity)
.contentShape(Rectangle())
}
.buttonStyle(.plain)
.background(
RoundedRectangle(cornerRadius: 10, style: .continuous)
.fill(selectedTheme == theme ? selectedTheme.currentTheme.bgColor : .clear)
.padding(-5)
)
}
private func selectTheme(_ theme: Theme) {
// Save theme value
GroupUserDefaults.groupDefaults.set(theme.rawValue, forKey: UserDefaultsStore.Keys.theme.rawValue)
GroupUserDefaults.groupDefaults.synchronize()
withAnimation(.easeInOut(duration: 0.2)) {
selectedTheme = theme
}
EventLogger.log(event: "change_theme_id", withData: ["id": theme.rawValue])
}
}
struct ThemePickerView_Previews: PreviewProvider {
static var previews: some View {
ThemePickerView()
}
}