a lot of theme work

This commit is contained in:
Trey t
2022-02-23 00:39:20 -06:00
parent 520119de85
commit d88c4e7a05
9 changed files with 76 additions and 27 deletions

View File

@@ -21,9 +21,13 @@ class AppDelegate: NSObject, UIApplicationDelegate {
UNUserNotificationCenter.current().delegate = self
let theme = UserDefaultsStore.theme()
UIPageControl.appearance().currentPageIndicatorTintColor = UIColor.label
UIPageControl.appearance().currentPageIndicatorTintColor = UIColor(theme.currentTheme.labelColor)
UIPageControl.appearance().pageIndicatorTintColor = UIColor.systemGray
UITabBar.appearance().backgroundColor = UIColor(cgColor: theme.currentTheme.secondaryBGColor.cgColor ?? UIColor.secondarySystemBackground.cgColor)
let appearance = UITabBarAppearance()
appearance.configureWithOpaqueBackground()
UITabBar.appearance().standardAppearance = appearance
UITabBar.appearance().scrollEdgeAppearance = appearance
return true
}

View File

@@ -79,9 +79,9 @@ final class DefaultMoodTint: MoodTintable {
case .great:
return Color(hex: "31d158")
case .missing:
return Color(uiColor: UIColor.systemGray4)
return Color(uiColor: UIColor.lightGray)
case .placeholder:
return Color(uiColor: UIColor.systemGray4)
return Color(uiColor: UIColor.lightGray)
}
}
@@ -98,9 +98,9 @@ final class DefaultMoodTint: MoodTintable {
case .great:
return Color(hex: "208939")
case .missing:
return Color(uiColor: UIColor.label)
return Color(uiColor: UIColor.lightGray)
case .placeholder:
return Color(uiColor: UIColor.label)
return Color(uiColor: UIColor.lightGray)
}
}
}
@@ -189,19 +189,19 @@ final class MonoChromeTint: MoodTintable {
static func color(forMood mood: Mood) -> Color {
switch mood {
case .horrible:
return .black
return Color(hex: "#000000")
case .bad:
return Color(uiColor: UIColor.systemGray)
return Color(hex: "#47474a")
case .average:
return Color(uiColor: UIColor.systemGray)
return Color(hex: "#7b7b81")
case .good:
return Color(uiColor: UIColor.systemGray2)
return Color(hex: "#a3a3ab")
case .great:
return Color(uiColor: UIColor.systemGray3)
return Color(hex: "#c2c1cb")
case .missing:
return Color(uiColor: UIColor.systemGray2)
return Color(hex: "#ff0000")
case .placeholder:
return Color(uiColor: UIColor.systemGray4)
return Color(hex: "#efeffb")
}
}

View File

@@ -85,7 +85,7 @@ extension ChartDataBuildable {
filledOutArray.append(view)
} else {
let thisDate = Calendar.current.date(bySetting: .day, value: day, of: month)!
let view = ChartType(color: Mood.missing.color,
let view = ChartType(color: Mood.placeholder.color,
weekDay: Calendar.current.component(.weekday, from: thisDate),
viewType: .square)
filledOutArray.append(view)
@@ -93,7 +93,7 @@ extension ChartDataBuildable {
}
for _ in filledOutArray.count...32 {
let view = ChartType(color: Mood.missing.color,
let view = ChartType(color: Mood.placeholder.color,
weekDay: 2,
viewType: .cicle)
filledOutArray.append(view)

View File

@@ -139,7 +139,7 @@ struct FilterView: View {
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 44, maxHeight: 44)
.cornerRadius(10)
.padding([.leading, .trailing])
.foregroundColor(theme.currentTheme.labelColor)
.colorScheme(.light)
ZStack {
theme.currentTheme.secondaryBGColor
@@ -156,6 +156,7 @@ struct FilterView: View {
.cornerRadius(10)
.padding([.leading, .trailing])
.foregroundColor(theme.currentTheme.labelColor)
.colorScheme(.light)
ZStack {
theme.currentTheme.secondaryBGColor

View File

@@ -318,6 +318,7 @@ extension HomeView {
.foregroundColor(theme.currentTheme.labelColor)
Text(" - ")
.padding([.leading, .trailing], -10)
.foregroundColor(theme.currentTheme.labelColor)
Text(Random.dayFormat(fromDate:entry.forDate!))
.font(.title3)
.foregroundColor(theme.currentTheme.labelColor)

View File

@@ -102,6 +102,7 @@ extension HomeViewTwo {
Text("Vote")
}
Text("dis top")
.foregroundColor(theme.currentTheme.secondaryBGColor)
}
}

View File

@@ -10,6 +10,10 @@ import SwiftUI
struct MainTabView: View {
@AppStorage(UserDefaultsStore.Keys.needsOnboarding.rawValue, store: GroupUserDefaults.groupDefaults) private var needsOnboarding = true
@AppStorage(UserDefaultsStore.Keys.theme.rawValue, store: GroupUserDefaults.groupDefaults) private var theme: Theme = .system
@AppStorage(UserDefaultsStore.Keys.moodTint.rawValue, store: GroupUserDefaults.groupDefaults) private var moodTint: MoodTints = .Default
let onboardingData = OnboardingDataDataManager.shared.savedOnboardingData
var body: some View {
@@ -38,7 +42,9 @@ struct MainTabView: View {
.tabItem {
Label(String(localized: "content_view_tab_customize"), systemImage: "pencil")
}
}.sheet(isPresented: $needsOnboarding, onDismiss: {
}
.accentColor(moodTint.color(forMood: .average))
.sheet(isPresented: $needsOnboarding, onDismiss: {
}, content: {
OnboardingMain(onboardingData: onboardingData,
@@ -47,6 +53,31 @@ struct MainTabView: View {
OnboardingDataDataManager.shared.updateOnboardingData(onboardingData: onboardingData)
})
})
.onAppear(perform: {
switch theme {
case .system:
UIApplication.shared.windows.first?.overrideUserInterfaceStyle = .unspecified
case .iFeel:
UIApplication.shared.windows.first?.overrideUserInterfaceStyle = .unspecified
case .dark:
UIApplication.shared.windows.first?.overrideUserInterfaceStyle = .dark
case .light:
UIApplication.shared.windows.first?.overrideUserInterfaceStyle = .light
}
})
.onChange(of: theme, perform: { value in
print("changed to ", value)
switch theme {
case .system:
UIApplication.shared.windows.first?.overrideUserInterfaceStyle = .unspecified
case .iFeel:
UIApplication.shared.windows.first?.overrideUserInterfaceStyle = .unspecified
case .dark:
UIApplication.shared.windows.first?.overrideUserInterfaceStyle = .dark
case .light:
UIApplication.shared.windows.first?.overrideUserInterfaceStyle = .light
}
})
}
}

View File

@@ -84,11 +84,13 @@ struct SettingsView: View {
}
}, label: {
Text(String(localized: "settings_view_special_thanks_to_title"))
.foregroundColor(theme.currentTheme.labelColor)
})
.padding()
if showSpecialThanks {
Text(String(localized: "settings_view_special_thanks_to_body"))
.foregroundColor(theme.currentTheme.labelColor)
.padding()
}
}
@@ -105,6 +107,7 @@ struct SettingsView: View {
editedDataClosure()
}, label: {
Text("Add test data")
.foregroundColor(theme.currentTheme.labelColor)
})
.padding()
}
@@ -120,6 +123,7 @@ struct SettingsView: View {
editedDataClosure()
}, label: {
Text("Clear DB")
.foregroundColor(theme.currentTheme.labelColor)
})
.padding()
}
@@ -137,10 +141,12 @@ struct SettingsView: View {
}
}, label: {
Text(String(localized: "settings_view_why_bg_mode_title"))
.foregroundColor(theme.currentTheme.labelColor)
})
.padding()
if showWhyBGMode {
Text(String(localized: "settings_view_why_bg_mode_body"))
.foregroundColor(theme.currentTheme.labelColor)
.padding()
}
}
@@ -160,6 +166,7 @@ struct SettingsView: View {
showOnboarding.toggle()
}, label: {
Text(String(localized: "settings_view_show_onboarding"))
.foregroundColor(theme.currentTheme.labelColor)
})
.padding()
}
@@ -171,13 +178,13 @@ struct SettingsView: View {
ZStack {
theme.currentTheme.secondaryBGColor
VStack {
Toggle(String(localized: "settings_use_cloudkit_title"),
isOn: $useCloudKit)
.onChange(of: useCloudKit) { value in
PersistenceController.shared.switchContainer()
}
Toggle(isOn: $useCloudKit, label: {
Text(String(localized: "settings_use_cloudkit_title"))
.foregroundColor(theme.currentTheme.labelColor)
})
.padding()
Text(String(localized: "settings_use_cloudkit_body"))
.foregroundColor(theme.currentTheme.labelColor)
}
.padding(.bottom)
}
@@ -192,6 +199,7 @@ struct SettingsView: View {
Image(systemName: syncMonitor.syncStateSummary.symbolName)
.foregroundColor(syncMonitor.syncStateSummary.symbolColor)
Text( syncMonitor.syncStateSummary.isBroken ? "cloudkit is broken" : "cloudkit is good")
.foregroundColor(theme.currentTheme.labelColor)
}
.padding()
}
@@ -205,6 +213,7 @@ struct SettingsView: View {
VStack {
Toggle(String(localized: "settings_use_delete_enable"),
isOn: $deleteEnabled)
.foregroundColor(theme.currentTheme.labelColor)
.padding()
}
}

View File

@@ -118,7 +118,7 @@ struct SharingListView: View {
.frame(minWidth: 0, maxWidth: .infinity)
.frame(height: 44)
.background(
Color(UIColor.secondarySystemBackground)
theme.currentTheme.secondaryBGColor
)
.opacity(0.9)
}
@@ -132,15 +132,17 @@ struct SharingListView: View {
})
}
}.background(
theme.currentTheme.bg
.edgesIgnoringSafeArea(.all)
)
}
}
.background(
theme.currentTheme.bg
.edgesIgnoringSafeArea(.top)
)
.sheet(isPresented: $selectedShare.showFuckingSheet,
onDismiss: didDismiss) {
selectedShare.fuckingWrappedShrable?.destination
}
}
}