Просмотр исходного кода

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

polscm32 2 лет назад
Родитель
Сommit
05eab3030b

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

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

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

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

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

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

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

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

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

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

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

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

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

@@ -273,16 +273,16 @@ extension OverrideProfilesConfig {
                     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."
                     )
-                }
+                }.listRowBackground(colorScheme == .dark ? Color.chart : Color.white)
 
                 Button("Return to Normal") {
                     state.cancelProfile()
                     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)
                 .onAppear(perform: configureView)
                 .onAppear { state.savedSettings() }

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

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