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>
This commit is contained in:
@@ -7,12 +7,6 @@
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct DefaultTextColor {
|
||||
static var textColor: Color {
|
||||
Color(UIColor.label)
|
||||
}
|
||||
}
|
||||
|
||||
protocol MoodTintable {
|
||||
static func color(forMood mood: Mood) -> Color
|
||||
static func secondary(forMood mood: Mood) -> Color
|
||||
@@ -232,37 +226,44 @@ final class AllRedMoodTint: MoodTintable {
|
||||
}
|
||||
|
||||
final class NeonMoodTint: MoodTintable {
|
||||
// Synthwave color palette matching the Neon voting style
|
||||
private static let neonCyan = Color(red: 0.0, green: 1.0, blue: 0.82)
|
||||
private static let neonLime = Color(red: 0.2, green: 1.0, blue: 0.6)
|
||||
private static let neonYellow = Color(red: 1.0, green: 0.9, blue: 0.0)
|
||||
private static let neonOrange = Color(red: 1.0, green: 0.5, blue: 0.0)
|
||||
private static let neonMagenta = Color(red: 1.0, green: 0.0, blue: 0.8)
|
||||
|
||||
static func color(forMood mood: Mood) -> Color {
|
||||
switch mood {
|
||||
case .horrible:
|
||||
return Color(hex: "#ff1818")
|
||||
return neonMagenta
|
||||
case .bad:
|
||||
return Color(hex: "#FF5F1F")
|
||||
return neonOrange
|
||||
case .average:
|
||||
return Color(hex: "#1F51FF")
|
||||
return neonYellow
|
||||
case .good:
|
||||
return Color(hex: "#FFF01F")
|
||||
return neonLime
|
||||
case .great:
|
||||
return Color(hex: "#39FF14")
|
||||
return neonCyan
|
||||
case .missing:
|
||||
return Color(uiColor: UIColor.systemGray2)
|
||||
case .placeholder:
|
||||
return Color(uiColor: UIColor.systemGray2)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static func secondary(forMood mood: Mood) -> Color {
|
||||
switch mood {
|
||||
case .horrible:
|
||||
return Color(hex: "#8b1113")
|
||||
return neonMagenta.opacity(0.6)
|
||||
case .bad:
|
||||
return Color(hex: "#893315")
|
||||
return neonOrange.opacity(0.6)
|
||||
case .average:
|
||||
return Color(hex: "#0f2a85")
|
||||
return neonYellow.opacity(0.6)
|
||||
case .good:
|
||||
return Color(hex: "#807a18")
|
||||
return neonLime.opacity(0.6)
|
||||
case .great:
|
||||
return Color(hex: "#218116")
|
||||
return neonCyan.opacity(0.6)
|
||||
case .missing:
|
||||
return Color(uiColor: UIColor.label)
|
||||
case .placeholder:
|
||||
|
||||
@@ -43,7 +43,7 @@ enum Theme: String, CaseIterable {
|
||||
|
||||
var currentTheme: Themeable {
|
||||
switch self {
|
||||
|
||||
|
||||
case .system:
|
||||
return SystemTheme()
|
||||
case .iFeel:
|
||||
@@ -54,6 +54,17 @@ enum Theme: String, CaseIterable {
|
||||
return AlwaysLight()
|
||||
}
|
||||
}
|
||||
|
||||
var preferredColorScheme: ColorScheme? {
|
||||
switch self {
|
||||
case .system, .iFeel:
|
||||
return nil // Follow system
|
||||
case .dark:
|
||||
return .dark
|
||||
case .light:
|
||||
return .light
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protocol Themeable {
|
||||
|
||||
@@ -178,7 +178,6 @@ class UserDefaultsStore {
|
||||
case customWidget
|
||||
case customMoodTint
|
||||
case customMoodTintUpdateNumber
|
||||
case textColor
|
||||
case showNSFW
|
||||
case shape
|
||||
case daysFilter
|
||||
@@ -200,24 +199,47 @@ class UserDefaultsStore {
|
||||
case currentSelectedHeaderViewViewType
|
||||
}
|
||||
|
||||
/// Cached onboarding data to avoid repeated JSON decoding
|
||||
private static var cachedOnboardingData: OnboardingData?
|
||||
|
||||
static func getOnboarding() -> OnboardingData {
|
||||
// Return cached data if available
|
||||
if let cached = cachedOnboardingData {
|
||||
return cached
|
||||
}
|
||||
|
||||
// Decode and cache
|
||||
if let data = GroupUserDefaults.groupDefaults.object(forKey: UserDefaultsStore.Keys.savedOnboardingData.rawValue) as? Data,
|
||||
let model = try? JSONDecoder().decode(OnboardingData.self, from: data) {
|
||||
cachedOnboardingData = model
|
||||
return model
|
||||
} else {
|
||||
return OnboardingData()
|
||||
let defaultData = OnboardingData()
|
||||
cachedOnboardingData = defaultData
|
||||
return defaultData
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Invalidate cached onboarding data (call when data might have changed externally)
|
||||
static func invalidateOnboardingCache() {
|
||||
cachedOnboardingData = nil
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
static func saveOnboarding(onboardingData: OnboardingData) -> OnboardingData {
|
||||
// Invalidate cache before saving
|
||||
cachedOnboardingData = nil
|
||||
|
||||
do {
|
||||
let data = try JSONEncoder().encode(onboardingData)
|
||||
GroupUserDefaults.groupDefaults.set(data, forKey: UserDefaultsStore.Keys.savedOnboardingData.rawValue)
|
||||
} catch {
|
||||
print("Error saving onboarding: \(error)")
|
||||
}
|
||||
return UserDefaultsStore.getOnboarding()
|
||||
|
||||
// Re-cache the saved data
|
||||
cachedOnboardingData = onboardingData
|
||||
return onboardingData
|
||||
}
|
||||
|
||||
static func moodMoodImagable() -> MoodImagable.Type {
|
||||
|
||||
Reference in New Issue
Block a user