Przeglądaj źródła

change color of form elements in the most important views to match the chart colors in home view

polscm32 2 lat temu
rodzic
commit
05eab3030b

+ 2 - 2
FreeAPS/Sources/Modules/AddCarbs/View/AddCarbsRootView.swift

@@ -128,7 +128,7 @@ extension AddCarbs {
                     .popover(isPresented: $isPromptPresented) {
                     .popover(isPresented: $isPromptPresented) {
                         presetPopover
                         presetPopover
                     }
                     }
-                }
+                }.listRowBackground(colorScheme == .dark ? Color.chart : Color.white)
 
 
                 Section {
                 Section {
                     Button { state.add(override, fetch: editMode) }
                     Button { state.add(override, fetch: editMode) }
@@ -140,7 +140,7 @@ extension AddCarbs {
 
 
                 Section {
                 Section {
                     mealPresets
                     mealPresets
-                }
+                }.listRowBackground(colorScheme == .dark ? Color.chart : Color.white)
             }.scrollContentBackground(.hidden).background(color)
             }.scrollContentBackground(.hidden).background(color)
                 .onAppear {
                 .onAppear {
                     configureView {
                     configureView {

+ 6 - 6
FreeAPS/Sources/Modules/AddTempTarget/View/AddTempTargetRootView.swift

@@ -49,7 +49,7 @@ extension AddTempTarget {
                         ForEach(state.presets) { preset in
                         ForEach(state.presets) { preset in
                             presetView(for: preset)
                             presetView(for: preset)
                         }
                         }
-                    }
+                    }.listRowBackground(colorScheme == .dark ? Color.chart : Color.white)
                 }
                 }
 
 
                 HStack {
                 HStack {
@@ -57,7 +57,7 @@ extension AddTempTarget {
                     Toggle(isOn: $state.viewPercantage) {}.controlSize(.mini)
                     Toggle(isOn: $state.viewPercantage) {}.controlSize(.mini)
                     Image(systemName: "figure.highintensity.intervaltraining")
                     Image(systemName: "figure.highintensity.intervaltraining")
                     Image(systemName: "fork.knife")
                     Image(systemName: "fork.knife")
-                }
+                }.listRowBackground(colorScheme == .dark ? Color.chart : Color.white)
 
 
                 if state.viewPercantage {
                 if state.viewPercantage {
                     Section {
                     Section {
@@ -98,7 +98,7 @@ extension AddTempTarget {
                                 ).accentColor(.green)
                                 ).accentColor(.green)
                             }
                             }
                         }
                         }
-                    }
+                    }.listRowBackground(colorScheme == .dark ? Color.chart : Color.white)
                 } else {
                 } else {
                     Section(header: Text("Custom")) {
                     Section(header: Text("Custom")) {
                         HStack {
                         HStack {
@@ -116,7 +116,7 @@ extension AddTempTarget {
                         DatePicker("Date", selection: $state.date)
                         DatePicker("Date", selection: $state.date)
                         Button { isPromptPresented = true }
                         Button { isPromptPresented = true }
                         label: { Text("Save as preset") }
                         label: { Text("Save as preset") }
-                    }
+                    }.listRowBackground(colorScheme == .dark ? Color.chart : Color.white)
                 }
                 }
                 if state.viewPercantage {
                 if state.viewPercantage {
                     Section {
                     Section {
@@ -130,7 +130,7 @@ extension AddTempTarget {
                         Button { isPromptPresented = true }
                         Button { isPromptPresented = true }
                         label: { Text("Save as preset") }
                         label: { Text("Save as preset") }
                             .disabled(state.duration == 0)
                             .disabled(state.duration == 0)
-                    }
+                    }.listRowBackground(colorScheme == .dark ? Color.chart : Color.white)
                 }
                 }
 
 
                 Section {
                 Section {
@@ -138,7 +138,7 @@ extension AddTempTarget {
                     label: { Text("Enact") }
                     label: { Text("Enact") }
                     Button { state.cancel() }
                     Button { state.cancel() }
                     label: { Text("Cancel Temp Target") }
                     label: { Text("Cancel Temp Target") }
-                }
+                }.listRowBackground(colorScheme == .dark ? Color.chart : Color.white)
             }.scrollContentBackground(.hidden).background(color)
             }.scrollContentBackground(.hidden).background(color)
                 .popover(isPresented: $isPromptPresented) {
                 .popover(isPresented: $isPromptPresented) {
                     Form {
                     Form {

+ 4 - 4
FreeAPS/Sources/Modules/Bolus/View/AlternativeBolusCalcRootView.swift

@@ -80,12 +80,12 @@ extension Bolus {
                     } else {
                     } else {
                         predictionChart
                         predictionChart
                     }
                     }
-                } header: { Text("Predictions") }
+                } header: { Text("Predictions") }.listRowBackground(colorScheme == .dark ? Color.chart : Color.white)
 
 
                 if fetch {
                 if fetch {
                     Section {
                     Section {
                         mealEntries
                         mealEntries
-                    } header: { Text("Meal Summary") }
+                    } header: { Text("Meal Summary") }.listRowBackground(colorScheme == .dark ? Color.chart : Color.white)
                 }
                 }
 
 
                 Section {
                 Section {
@@ -171,7 +171,7 @@ extension Bolus {
                         }
                         }
                     }
                     }
 
 
-                } header: { Text("Bolus") }
+                } header: { Text("Bolus") }.listRowBackground(colorScheme == .dark ? Color.chart : Color.white)
 
 
                 if state.amount > 0 {
                 if state.amount > 0 {
                     Section {
                     Section {
@@ -193,7 +193,7 @@ extension Bolus {
                             state.showModal(for: nil)
                             state.showModal(for: nil)
                         }
                         }
                         label: { Text("Continue without bolus") }.frame(maxWidth: .infinity, alignment: .center)
                         label: { Text("Continue without bolus") }.frame(maxWidth: .infinity, alignment: .center)
-                    }
+                    }.listRowBackground(colorScheme == .dark ? Color.chart : Color.white)
                 }
                 }
             }.scrollContentBackground(.hidden).background(color)
             }.scrollContentBackground(.hidden).background(color)
                 .blur(radius: showInfo ? 3 : 0)
                 .blur(radius: showInfo ? 3 : 0)

+ 4 - 4
FreeAPS/Sources/Modules/Bolus/View/DefaultBolusCalcRootView.swift

@@ -60,12 +60,12 @@ extension Bolus {
                     } else {
                     } else {
                         predictionChart
                         predictionChart
                     }
                     }
-                } header: { Text("Predictions") }
+                } header: { Text("Predictions") }.listRowBackground(colorScheme == .dark ? Color.chart : Color.white)
 
 
                 if fetch {
                 if fetch {
                     Section {
                     Section {
                         mealEntries
                         mealEntries
-                    } header: { Text("Meal Summary") }
+                    } header: { Text("Meal Summary") }.listRowBackground(colorScheme == .dark ? Color.chart : Color.white)
                 }
                 }
 
 
                 Section {
                 Section {
@@ -112,7 +112,7 @@ extension Bolus {
                         Text(!(state.amount > state.maxBolus) ? "U" : "😵").foregroundColor(.secondary)
                         Text(!(state.amount > state.maxBolus) ? "U" : "😵").foregroundColor(.secondary)
                     }
                     }
 
 
-                } header: { Text("Bolus") }
+                } header: { Text("Bolus") }.listRowBackground(colorScheme == .dark ? Color.chart : Color.white)
 
 
                 if state.amount > 0 {
                 if state.amount > 0 {
                     Section {
                     Section {
@@ -135,7 +135,7 @@ extension Bolus {
                             state.showModal(for: nil)
                             state.showModal(for: nil)
                         }
                         }
                         label: { Text("Continue without bolus") }.frame(maxWidth: .infinity, alignment: .center)
                         label: { Text("Continue without bolus") }.frame(maxWidth: .infinity, alignment: .center)
-                    }
+                    }.listRowBackground(colorScheme == .dark ? Color.chart : Color.white)
                 }
                 }
             }.scrollContentBackground(.hidden).background(color)
             }.scrollContentBackground(.hidden).background(color)
                 .alert(isPresented: $displayError) {
                 .alert(isPresented: $displayError) {

+ 6 - 6
FreeAPS/Sources/Modules/DataTable/View/DataTableRootView.swift

@@ -161,7 +161,7 @@ extension DataTable {
                         Text("No data.")
                         Text("No data.")
                     }
                     }
                 }
                 }
-            }
+            }.listRowBackground(colorScheme == .dark ? Color.chart : Color.white)
         }
         }
 
 
         private var mealsList: some View {
         private var mealsList: some View {
@@ -180,7 +180,7 @@ extension DataTable {
                         Text("No data.")
                         Text("No data.")
                     }
                     }
                 }
                 }
-            }
+            }.listRowBackground(colorScheme == .dark ? Color.chart : Color.white)
         }
         }
 
 
         private var glucoseList: some View {
         private var glucoseList: some View {
@@ -199,7 +199,7 @@ extension DataTable {
                         Text("No data.")
                         Text("No data.")
                     }
                     }
                 }
                 }
-            }
+            }.listRowBackground(colorScheme == .dark ? Color.chart : Color.white)
         }
         }
 
 
         @ViewBuilder private func addGlucoseView() -> some View {
         @ViewBuilder private func addGlucoseView() -> some View {
@@ -221,7 +221,7 @@ extension DataTable {
                                 )
                                 )
                                 Text(state.units.rawValue).foregroundStyle(.secondary)
                                 Text(state.units.rawValue).foregroundStyle(.secondary)
                             }
                             }
-                        }
+                        }.listRowBackground(colorScheme == .dark ? Color.chart : Color.white)
 
 
                         Section {
                         Section {
                             HStack {
                             HStack {
@@ -403,11 +403,11 @@ extension DataTable {
                                 )
                                 )
                                 Text("U").foregroundColor(.secondary)
                                 Text("U").foregroundColor(.secondary)
                             }
                             }
-                        }
+                        }.listRowBackground(colorScheme == .dark ? Color.chart : Color.white)
 
 
                         Section {
                         Section {
                             DatePicker("Date", selection: $state.externalInsulinDate, in: ...Date())
                             DatePicker("Date", selection: $state.externalInsulinDate, in: ...Date())
-                        }
+                        }.listRowBackground(colorScheme == .dark ? Color.chart : Color.white)
 
 
                         let amountWarningCondition = (state.externalInsulinAmount > state.maxBolus)
                         let amountWarningCondition = (state.externalInsulinAmount > state.maxBolus)
 
 

+ 3 - 2
FreeAPS/Sources/Modules/Home/View/HomeRootView.swift

@@ -785,7 +785,8 @@ extension Home {
                     .fill(color)
                     .fill(color)
                     .shadow(
                     .shadow(
                         color: Color.black.opacity(0.33),
                         color: Color.black.opacity(0.33),
-                        radius: 3)
+                        radius: 3
+                    )
                     .ignoresSafeArea(edges: .all)
                     .ignoresSafeArea(edges: .all)
 
 
                 VStack(alignment: .leading) {
                 VStack(alignment: .leading) {
@@ -897,7 +898,7 @@ extension Home {
                         profileView(geo).padding(.vertical)
                         profileView(geo).padding(.vertical)
 
 
                         RoundedRectangle(cornerRadius: 15)
                         RoundedRectangle(cornerRadius: 15)
-                            .fill(Color("Chart"))
+                            .fill(Color.chart)
                             .overlay(mainChart)
                             .overlay(mainChart)
                             .clipShape(RoundedRectangle(cornerRadius: 15))
                             .clipShape(RoundedRectangle(cornerRadius: 15))
                             .shadow(
                             .shadow(

+ 6 - 6
FreeAPS/Sources/Modules/OverrideProfilesConfig/View/OverrideProfilesRootView.swift

@@ -273,16 +273,16 @@ extension OverrideProfilesConfig {
                     Text(
                     Text(
                         "Your profile basal insulin will be adjusted with the override percentage and your profile ISF and CR will be inversly adjusted with the percentage."
                         "Your profile basal insulin will be adjusted with the override percentage and your profile ISF and CR will be inversly adjusted with the percentage."
                     )
                     )
-                }
+                }.listRowBackground(colorScheme == .dark ? Color.chart : Color.white)
 
 
                 Button("Return to Normal") {
                 Button("Return to Normal") {
                     state.cancelProfile()
                     state.cancelProfile()
                     dismiss()
                     dismiss()
-                }
-                .frame(maxWidth: .infinity, alignment: .center)
-                .buttonStyle(BorderlessButtonStyle())
-                .disabled(!state.isEnabled)
-                .tint(.red)
+                }.listRowBackground(colorScheme == .dark ? Color.chart : Color.white)
+                    .frame(maxWidth: .infinity, alignment: .center)
+                    .buttonStyle(BorderlessButtonStyle())
+                    .disabled(!state.isEnabled)
+                    .tint(.red)
             }.scrollContentBackground(.hidden).background(color)
             }.scrollContentBackground(.hidden).background(color)
                 .onAppear(perform: configureView)
                 .onAppear(perform: configureView)
                 .onAppear { state.savedSettings() }
                 .onAppear { state.savedSettings() }

+ 9 - 9
FreeAPS/Sources/Modules/Settings/View/SettingsRootView.swift

@@ -35,13 +35,13 @@ extension Settings {
                     Text(
                     Text(
                         "iAPS v\(state.versionNumber) (\(state.buildNumber))\nBranch: \(state.branch) \(state.copyrightNotice) "
                         "iAPS v\(state.versionNumber) (\(state.buildNumber))\nBranch: \(state.branch) \(state.copyrightNotice) "
                     ).textCase(nil)
                     ).textCase(nil)
-                }
+                }.listRowBackground(colorScheme == .dark ? Color.chart : Color.white)
 
 
                 Section {
                 Section {
                     Text("Pump").navigationLink(to: .pumpConfig, from: self)
                     Text("Pump").navigationLink(to: .pumpConfig, from: self)
                     Text("CGM").navigationLink(to: .cgm, from: self)
                     Text("CGM").navigationLink(to: .cgm, from: self)
                     Text("Watch").navigationLink(to: .watch, from: self)
                     Text("Watch").navigationLink(to: .watch, from: self)
-                } header: { Text("Devices") }
+                } header: { Text("Devices") }.listRowBackground(colorScheme == .dark ? Color.chart : Color.white)
 
 
                 Section {
                 Section {
                     Text("Nightscout").navigationLink(to: .nighscoutConfig, from: self)
                     Text("Nightscout").navigationLink(to: .nighscoutConfig, from: self)
@@ -49,7 +49,7 @@ extension Settings {
                         Text("Apple Health").navigationLink(to: .healthkit, from: self)
                         Text("Apple Health").navigationLink(to: .healthkit, from: self)
                     }
                     }
                     Text("Notifications").navigationLink(to: .notificationsConfig, from: self)
                     Text("Notifications").navigationLink(to: .notificationsConfig, from: self)
-                } header: { Text("Services") }
+                } header: { Text("Services") }.listRowBackground(colorScheme == .dark ? Color.chart : Color.white)
 
 
                 Section {
                 Section {
                     Text("Pump Settings").navigationLink(to: .pumpSettingsEditor, from: self)
                     Text("Pump Settings").navigationLink(to: .pumpSettingsEditor, from: self)
@@ -57,12 +57,12 @@ extension Settings {
                     Text("Insulin Sensitivities").navigationLink(to: .isfEditor, from: self)
                     Text("Insulin Sensitivities").navigationLink(to: .isfEditor, from: self)
                     Text("Carb Ratios").navigationLink(to: .crEditor, from: self)
                     Text("Carb Ratios").navigationLink(to: .crEditor, from: self)
                     Text("Target Glucose").navigationLink(to: .targetsEditor, from: self)
                     Text("Target Glucose").navigationLink(to: .targetsEditor, from: self)
-                } header: { Text("Configuration") }
+                } header: { Text("Configuration") }.listRowBackground(colorScheme == .dark ? Color.chart : Color.white)
 
 
                 Section {
                 Section {
                     Text("OpenAPS").navigationLink(to: .preferencesEditor, from: self)
                     Text("OpenAPS").navigationLink(to: .preferencesEditor, from: self)
                     Text("Autotune").navigationLink(to: .autotuneConfig, from: self)
                     Text("Autotune").navigationLink(to: .autotuneConfig, from: self)
-                } header: { Text("OpenAPS") }
+                } header: { Text("OpenAPS") }.listRowBackground(colorScheme == .dark ? Color.chart : Color.white)
 
 
                 Section {
                 Section {
                     Text("UI/UX").navigationLink(to: .statisticsConfig, from: self)
                     Text("UI/UX").navigationLink(to: .statisticsConfig, from: self)
@@ -70,7 +70,7 @@ extension Settings {
                     Text("Bolus Calculator").navigationLink(to: .bolusCalculatorConfig, from: self)
                     Text("Bolus Calculator").navigationLink(to: .bolusCalculatorConfig, from: self)
                     Text("Fat And Protein Conversion").navigationLink(to: .fpuConfig, from: self)
                     Text("Fat And Protein Conversion").navigationLink(to: .fpuConfig, from: self)
                     Text("Dynamic ISF").navigationLink(to: .dynamicISF, from: self)
                     Text("Dynamic ISF").navigationLink(to: .dynamicISF, from: self)
-                } header: { Text("Extra Features") }
+                } header: { Text("Extra Features") }.listRowBackground(colorScheme == .dark ? Color.chart : Color.white)
 
 
                 Section {
                 Section {
                     Toggle("Debug options", isOn: $state.debugOptions)
                     Toggle("Debug options", isOn: $state.debugOptions)
@@ -134,18 +134,18 @@ extension Settings {
                                 .navigationLink(to: .configEditor(file: OpenAPS.FreeAPS.settings), from: self)
                                 .navigationLink(to: .configEditor(file: OpenAPS.FreeAPS.settings), from: self)
                         }
                         }
                     }
                     }
-                } header: { Text("Developer") }
+                } header: { Text("Developer") }.listRowBackground(colorScheme == .dark ? Color.chart : Color.white)
 
 
                 Section {
                 Section {
                     Toggle("Animated Background", isOn: $state.animatedBackground)
                     Toggle("Animated Background", isOn: $state.animatedBackground)
-                }
+                }.listRowBackground(colorScheme == .dark ? Color.chart : Color.white)
 
 
                 Section {
                 Section {
                     Text("Share logs")
                     Text("Share logs")
                         .onTapGesture {
                         .onTapGesture {
                             showShareSheet = true
                             showShareSheet = true
                         }
                         }
-                }
+                }.listRowBackground(colorScheme == .dark ? Color.chart : Color.white)
             }.scrollContentBackground(.hidden).background(color)
             }.scrollContentBackground(.hidden).background(color)
                 .sheet(isPresented: $showShareSheet) {
                 .sheet(isPresented: $showShareSheet) {
                     ShareSheet(activityItems: state.logItems())
                     ShareSheet(activityItems: state.logItems())