Bläddra i källkod

Refactoring
* add background color to asset
* add color for main chart to assets
* remove unnecessary code
* change navigation bar display mode in profile view to .inline for coherence

polscm32 2 år sedan
förälder
incheckning
475911ac9d

+ 38 - 0
FreeAPS/Resources/Assets.xcassets/Colors/Background_1.colorset/Contents.json

@@ -0,0 +1,38 @@
+{
+  "colors" : [
+    {
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0.216",
+          "green" : "0.133",
+          "red" : "0.039"
+        }
+      },
+      "idiom" : "universal"
+    },
+    {
+      "appearances" : [
+        {
+          "appearance" : "luminosity",
+          "value" : "dark"
+        }
+      ],
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0.216",
+          "green" : "0.133",
+          "red" : "0.039"
+        }
+      },
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

+ 38 - 0
FreeAPS/Resources/Assets.xcassets/Colors/Background_2.colorset/Contents.json

@@ -0,0 +1,38 @@
+{
+  "colors" : [
+    {
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0.109",
+          "green" : "0.058",
+          "red" : "0.011"
+        }
+      },
+      "idiom" : "universal"
+    },
+    {
+      "appearances" : [
+        {
+          "appearance" : "luminosity",
+          "value" : "dark"
+        }
+      ],
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0.109",
+          "green" : "0.058",
+          "red" : "0.011"
+        }
+      },
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

+ 38 - 0
FreeAPS/Resources/Assets.xcassets/Colors/Chart.colorset/Contents.json

@@ -0,0 +1,38 @@
+{
+  "colors" : [
+    {
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "1.000",
+          "green" : "1.000",
+          "red" : "1.000"
+        }
+      },
+      "idiom" : "universal"
+    },
+    {
+      "appearances" : [
+        {
+          "appearance" : "luminosity",
+          "value" : "dark"
+        }
+      ],
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0.080",
+          "green" : "0.080",
+          "red" : "0.080"
+        }
+      },
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

+ 1 - 1
FreeAPS/Sources/Models/FreeAPSSettings.swift

@@ -284,7 +284,7 @@ extension FreeAPSSettings: Decodable {
         if let historyLayout = try? container.decode(HistoryLayout.self, forKey: .historyLayout) {
             settings.historyLayout = historyLayout
         }
-        
+
         if let lockScreenView = try? container.decode(LockScreenView.self, forKey: .lockScreenView) {
             settings.lockScreenView = lockScreenView
         }

+ 19 - 17
FreeAPS/Sources/Modules/AddCarbs/View/AddCarbsRootView.swift

@@ -30,6 +30,25 @@ extension AddCarbs {
             return formatter
         }
 
+        private var color: LinearGradient {
+            colorScheme == .dark ? LinearGradient(
+                gradient: Gradient(colors: [
+                    Color("Background_1"),
+                    Color("Background_1"),
+                    Color("Background_2"),
+                    Color("Background_1")
+                ]),
+                startPoint: .top,
+                endPoint: .bottom
+            )
+                :
+                LinearGradient(
+                    gradient: Gradient(colors: [Color.gray.opacity(0.1)]),
+                    startPoint: .top,
+                    endPoint: .bottom
+                )
+        }
+
         var body: some View {
             Form {
                 if let carbsReq = state.carbsRequired, state.carbs < carbsReq {
@@ -163,23 +182,6 @@ extension AddCarbs {
             }
         }
 
-        private var color: LinearGradient {
-            colorScheme == .dark ?  LinearGradient(
-                gradient: Gradient(colors: [
-                    // RGB(10, 34, 55)
-                    Color(red: 0.03921568627, green: 0.1333333333, blue: 0.2156862745),
-                    // RGB(3, 15, 28)
-                    Color(red: 0.011, green: 0.058, blue: 0.109),
-                    // RGB(10, 34, 55)
-                    Color(red: 0.03921568627, green: 0.1333333333, blue: 0.2156862745)
-                ]),
-                startPoint: .top,
-                endPoint: .bottom
-            )
-                :
-                LinearGradient(gradient: Gradient(colors: [Color.gray.opacity(0.1)]), startPoint: .top, endPoint: .bottom)
-        }
-
         private var empty: Bool {
             state.carbs <= 0 && state.fat <= 0 && state.protein <= 0
         }

+ 19 - 17
FreeAPS/Sources/Modules/AddTempTarget/View/AddTempTargetRootView.swift

@@ -25,6 +25,25 @@ extension AddTempTarget {
             return formatter
         }
 
+        private var color: LinearGradient {
+            colorScheme == .dark ? LinearGradient(
+                gradient: Gradient(colors: [
+                    Color("Background_1"),
+                    Color("Background_1"),
+                    Color("Background_2"),
+                    Color("Background_1")
+                ]),
+                startPoint: .top,
+                endPoint: .bottom
+            )
+                :
+                LinearGradient(
+                    gradient: Gradient(colors: [Color.gray.opacity(0.1)]),
+                    startPoint: .top,
+                    endPoint: .bottom
+                )
+        }
+
         var body: some View {
             Form {
                 if !state.presets.isEmpty {
@@ -204,22 +223,5 @@ extension AddTempTarget {
                     }
             }
         }
-
-        private var color: LinearGradient {
-            colorScheme == .dark ?  LinearGradient(
-                gradient: Gradient(colors: [
-                    // RGB(10, 34, 55)
-                    Color(red: 0.03921568627, green: 0.1333333333, blue: 0.2156862745),
-                    // RGB(3, 15, 28)
-                    Color(red: 0.011, green: 0.058, blue: 0.109),
-                    // RGB(10, 34, 55)
-                    Color(red: 0.03921568627, green: 0.1333333333, blue: 0.2156862745)
-                ]),
-                startPoint: .top,
-                endPoint: .bottom
-            )
-                :
-                LinearGradient(gradient: Gradient(colors: [Color.gray.opacity(0.1)]), startPoint: .top, endPoint: .bottom)
-        }
     }
 }

+ 52 - 51
FreeAPS/Sources/Modules/Bolus/View/AlternativeBolusCalcRootView.swift

@@ -55,6 +55,25 @@ extension Bolus {
             } else { return 0 }
         }
 
+        private var color: LinearGradient {
+            colorScheme == .dark ? LinearGradient(
+                gradient: Gradient(colors: [
+                    Color("Background_1"),
+                    Color("Background_1"),
+                    Color("Background_2"),
+                    Color("Background_1")
+                ]),
+                startPoint: .top,
+                endPoint: .bottom
+            )
+                :
+                LinearGradient(
+                    gradient: Gradient(colors: [Color.gray.opacity(0.1)]),
+                    startPoint: .top,
+                    endPoint: .bottom
+                )
+        }
+
         var body: some View {
             Form {
                 Section {
@@ -65,7 +84,6 @@ extension Bolus {
                     }
                 } header: { Text("Predictions") }
 
-                Section {}
                 if fetch {
                     Section {
                         mealEntries
@@ -180,60 +198,43 @@ extension Bolus {
                     }
                 }
             }.scrollContentBackground(.hidden).background(color)
-            .blur(radius: showInfo ? 3 : 0)
-            .navigationTitle("Enact Bolus")
-            .navigationBarTitleDisplayMode(.inline)
-            .navigationBarItems(
-                leading: Button {
-                    carbsView()
+                .blur(radius: showInfo ? 3 : 0)
+                .navigationTitle("Enact Bolus")
+                .navigationBarTitleDisplayMode(.inline)
+                .navigationBarItems(
+                    leading: Button {
+                        carbsView()
+                    }
+                    label: {
+                        HStack {
+                            Image(systemName: "chevron.backward")
+                            Text("Meal")
+                        }
+                    },
+                    trailing: Button { state.hideModal() }
+                    label: { Text("Close") }
+                )
+                .onAppear {
+                    configureView {
+                        state.waitForSuggestionInitial = waitForSuggestion
+                        state.waitForSuggestion = waitForSuggestion
+                        state.insulinCalculated = state.calculateInsulin()
+                    }
                 }
-                label: {
-                    HStack {
-                        Image(systemName: "chevron.backward")
-                        Text("Meal")
+                .onDisappear {
+                    if fetch, hasFatOrProtein, !keepForNextWiew, state.useCalc {
+                        state.delete(deleteTwice: true, meal: meal)
+                    } else if fetch, !keepForNextWiew, state.useCalc {
+                        state.delete(deleteTwice: false, meal: meal)
                     }
-                },
-                trailing: Button { state.hideModal() }
-                label: { Text("Close") }
-            )
-            .onAppear {
-                configureView {
-                    state.waitForSuggestionInitial = waitForSuggestion
-                    state.waitForSuggestion = waitForSuggestion
-                    state.insulinCalculated = state.calculateInsulin()
                 }
-            }
-            .onDisappear {
-                if fetch, hasFatOrProtein, !keepForNextWiew, state.useCalc {
-                    state.delete(deleteTwice: true, meal: meal)
-                } else if fetch, !keepForNextWiew, state.useCalc {
-                    state.delete(deleteTwice: false, meal: meal)
+                .sheet(isPresented: $showInfo) {
+                    calculationsDetailView
+                        .presentationDetents(
+                            [fetch ? .large : .fraction(0.9), .large],
+                            selection: $calculatorDetent
+                        )
                 }
-            }
-            .sheet(isPresented: $showInfo) {
-                calculationsDetailView
-                    .presentationDetents(
-                        [fetch ? .large : .fraction(0.9), .large],
-                        selection: $calculatorDetent
-                    )
-            }
-        }
-
-        private var color: LinearGradient {
-            colorScheme == .dark ?  LinearGradient(
-                gradient: Gradient(colors: [
-                    // RGB(10, 34, 55)
-                    Color(red: 0.03921568627, green: 0.1333333333, blue: 0.2156862745),
-                    // RGB(3, 15, 28)
-                    Color(red: 0.011, green: 0.058, blue: 0.109),
-                    // RGB(10, 34, 55)
-                    Color(red: 0.03921568627, green: 0.1333333333, blue: 0.2156862745)
-                ]),
-                startPoint: .top,
-                endPoint: .bottom
-            )
-                :
-                LinearGradient(gradient: Gradient(colors: [Color.gray.opacity(0.1)]), startPoint: .top, endPoint: .bottom)
         }
 
         var predictionChart: some View {

+ 52 - 50
FreeAPS/Sources/Modules/Bolus/View/DefaultBolusCalcRootView.swift

@@ -34,22 +34,24 @@ extension Bolus {
                 return 1
             } else { return 0 }
         }
-        
+
         private var color: LinearGradient {
-            colorScheme == .dark ?  LinearGradient(
+            colorScheme == .dark ? LinearGradient(
                 gradient: Gradient(colors: [
-                    // RGB(10, 34, 55)
-                    Color(red: 0.03921568627, green: 0.1333333333, blue: 0.2156862745),
-                    // RGB(3, 15, 28)
-                    Color(red: 0.011, green: 0.058, blue: 0.109),
-                    // RGB(10, 34, 55)
-                    Color(red: 0.03921568627, green: 0.1333333333, blue: 0.2156862745)
+                    Color("Background_1"),
+                    Color("Background_1"),
+                    Color("Background_2"),
+                    Color("Background_1")
                 ]),
                 startPoint: .top,
                 endPoint: .bottom
             )
                 :
-                LinearGradient(gradient: Gradient(colors: [Color.gray.opacity(0.1)]), startPoint: .top, endPoint: .bottom)
+                LinearGradient(
+                    gradient: Gradient(colors: [Color.gray.opacity(0.1)]),
+                    startPoint: .top,
+                    endPoint: .bottom
+                )
         }
 
         var body: some View {
@@ -138,52 +140,52 @@ extension Bolus {
                     }
                 }
             }.scrollContentBackground(.hidden).background(color)
-            .alert(isPresented: $displayError) {
-                Alert(
-                    title: Text("Warning!"),
-                    message: Text("\n" + alertString() + "\n"),
-                    primaryButton: .destructive(
-                        Text("Add"),
-                        action: {
-                            state.amount = state.insulinRecommended
-                            displayError = false
-                        }
-                    ),
-                    secondaryButton: .cancel()
-                )
-            }.onAppear {
-                configureView {
-                    state.waitForSuggestionInitial = waitForSuggestion
-                    state.waitForSuggestion = waitForSuggestion
+                .alert(isPresented: $displayError) {
+                    Alert(
+                        title: Text("Warning!"),
+                        message: Text("\n" + alertString() + "\n"),
+                        primaryButton: .destructive(
+                            Text("Add"),
+                            action: {
+                                state.amount = state.insulinRecommended
+                                displayError = false
+                            }
+                        ),
+                        secondaryButton: .cancel()
+                    )
+                }.onAppear {
+                    configureView {
+                        state.waitForSuggestionInitial = waitForSuggestion
+                        state.waitForSuggestion = waitForSuggestion
+                    }
                 }
-            }
 
-            .onDisappear {
-                if fetch, hasFatOrProtein, !keepForNextWiew, !state.useCalc {
-                    state.delete(deleteTwice: true, meal: meal)
-                } else if fetch, !keepForNextWiew, !state.useCalc {
-                    state.delete(deleteTwice: false, meal: meal)
+                .onDisappear {
+                    if fetch, hasFatOrProtein, !keepForNextWiew, !state.useCalc {
+                        state.delete(deleteTwice: true, meal: meal)
+                    } else if fetch, !keepForNextWiew, !state.useCalc {
+                        state.delete(deleteTwice: false, meal: meal)
+                    }
                 }
-            }
 
-            .navigationTitle("Enact Bolus")
-            .navigationBarTitleDisplayMode(.inline)
-            .navigationBarItems(
-                leading: Button {
-                    carbsView()
-                }
-                label: {
-                    HStack {
-                        Image(systemName: "chevron.backward")
-                        Text("Meal")
+                .navigationTitle("Enact Bolus")
+                .navigationBarTitleDisplayMode(.inline)
+                .navigationBarItems(
+                    leading: Button {
+                        carbsView()
                     }
-                },
-                trailing: Button { state.hideModal() }
-                label: { Text("Close") }
-            )
-            .popup(isPresented: presentInfo, alignment: .center, direction: .bottom) {
-                bolusInfo
-            }
+                    label: {
+                        HStack {
+                            Image(systemName: "chevron.backward")
+                            Text("Meal")
+                        }
+                    },
+                    trailing: Button { state.hideModal() }
+                    label: { Text("Close") }
+                )
+                .popup(isPresented: presentInfo, alignment: .center, direction: .bottom) {
+                    bolusInfo
+                }
         }
 
         var disabled: Bool {

+ 11 - 9
FreeAPS/Sources/Modules/DataTable/View/DataTableRootView.swift

@@ -58,22 +58,24 @@ extension DataTable {
         }
 
         private var color: LinearGradient {
-            colorScheme == .dark ?  LinearGradient(
+            colorScheme == .dark ? LinearGradient(
                 gradient: Gradient(colors: [
-                    // RGB(10, 34, 55)
-                    Color(red: 0.03921568627, green: 0.1333333333, blue: 0.2156862745),
-                    // RGB(3, 15, 28)
-                    Color(red: 0.011, green: 0.058, blue: 0.109),
-                    // RGB(10, 34, 55)
-                    Color(red: 0.03921568627, green: 0.1333333333, blue: 0.2156862745)
+                    Color("Background_1"),
+                    Color("Background_1"),
+                    Color("Background_2"),
+                    Color("Background_1")
                 ]),
                 startPoint: .top,
                 endPoint: .bottom
             )
                 :
-                LinearGradient(gradient: Gradient(colors: [Color.gray.opacity(0.1)]), startPoint: .top, endPoint: .bottom)
+                LinearGradient(
+                    gradient: Gradient(colors: [Color.gray.opacity(0.1)]),
+                    startPoint: .top,
+                    endPoint: .bottom
+                )
         }
-        
+
         var body: some View {
             VStack {
                 Picker("Mode", selection: $state.mode) {

+ 3 - 4
FreeAPS/Sources/Modules/Home/View/Chart/MainChartView.swift

@@ -508,7 +508,6 @@ extension MainChartView {
 /// calculates the glucose value thats the nearest to parameter 'time'
 /// if time is later than all the arrays values return the last element of BloodGlucose
 extension MainChartView {
-    
 //    private func timeToNearestGlucose(time: TimeInterval) -> BloodGlucose {
 //        var nextIndex = 0
 //        if glucose.last?.dateString.timeIntervalSince1970 ?? Date().timeIntervalSince1970 < time {
@@ -531,8 +530,9 @@ extension MainChartView {
 //        return glucose[nextIndex]
 //    }
 
-    //MARK: TEST
-    ///fix for index out of range problem in simulator
+    // MARK: TEST
+
+    /// fix for index out of range problem in simulator
     private func timeToNearestGlucose(time: TimeInterval) -> BloodGlucose {
         /// If the glucose array is empty, return a default BloodGlucose object or handle it accordingly
         guard let lastGlucose = glucose.last else {
@@ -560,7 +560,6 @@ extension MainChartView {
         }
     }
 
-    
     private func fullWidth(viewWidth: CGFloat) -> CGFloat {
         viewWidth * CGFloat(hours) / CGFloat(min(max(screenHours, 2), 24))
     }

+ 1 - 7
FreeAPS/Sources/Modules/Home/View/Header/CurrentGlucoseView.swift

@@ -194,15 +194,9 @@ struct CircleShape: View {
     let gradient: AngularGradient
 
     var body: some View {
-        let colorBackground: Color = colorScheme == .dark ? Color(
-            red: 0.05490196078,
-            green: 0.05490196078,
-            blue: 0.05490196078
-        ) : .white
-
         Circle()
             .stroke(gradient, lineWidth: 6)
-            .background(Circle().fill(colorBackground))
+            .background(Circle().fill(Color("Chart")))
             .frame(width: 130, height: 130)
     }
 }

+ 22 - 110
FreeAPS/Sources/Modules/Home/View/HomeRootView.swift

@@ -109,55 +109,23 @@ extension Home {
             return scene
         }
 
-        @ViewBuilder func header(_: GeometryProxy) -> some View {
-            HStack {
-                Spacer()
-                pumpView
-                Spacer()
-            }
-        }
-
-        var cobIobView: some View {
-            VStack(alignment: .leading, spacing: 12) {
-                HStack {
-                    Text("IOB").font(.footnote).foregroundColor(.secondary)
-                    Text(
-                        (numberFormatter.string(from: (state.suggestion?.iob ?? 0) as NSNumber) ?? "0") +
-                            NSLocalizedString(" U", comment: "Insulin unit")
-                    )
-                    .font(.footnote).fontWeight(.bold)
-                }.frame(alignment: .top)
-                HStack {
-                    Text("COB").font(.footnote).foregroundColor(.secondary)
-                    Text(
-                        (numberFormatter.string(from: (state.suggestion?.cob ?? 0) as NSNumber) ?? "0") +
-                            NSLocalizedString(" g", comment: "gram of carbs")
-                    )
-                    .font(.footnote).fontWeight(.bold)
-                }.frame(alignment: .bottom)
-            }
-        }
-
-        var cobIobView2: some View {
-            HStack {
-                Text("IOB").font(.callout).foregroundColor(.secondary)
-                Text(
-                    (numberFormatter.string(from: (state.suggestion?.iob ?? 0) as NSNumber) ?? "0") +
-                        NSLocalizedString(" U", comment: "Insulin unit")
-                )
-                .font(.callout).fontWeight(.bold)
-
-                Spacer()
-
-                Text("COB").font(.callout).foregroundColor(.secondary)
-                Text(
-                    (numberFormatter.string(from: (state.suggestion?.cob ?? 0) as NSNumber) ?? "0") +
-                        NSLocalizedString(" g", comment: "gram of carbs")
+        private var color: LinearGradient {
+            colorScheme == .dark ? LinearGradient(
+                gradient: Gradient(colors: [
+                    Color("Background_1"),
+                    Color("Background_1"),
+                    Color("Background_2"),
+                    Color("Background_1")
+                ]),
+                startPoint: .top,
+                endPoint: .bottom
+            )
+                :
+                LinearGradient(
+                    gradient: Gradient(colors: [Color.gray.opacity(0.1)]),
+                    startPoint: .top,
+                    endPoint: .bottom
                 )
-                .font(.callout).fontWeight(.bold)
-
-                Spacer()
-            }
         }
 
         var glucoseView: some View {
@@ -406,32 +374,6 @@ extension Home {
             .padding(.bottom)
         }
 
-        private func selectedProfile() -> (name: String, isOn: Bool) {
-            var profileString = ""
-            var display: Bool = false
-
-            let duration = (fetchedPercent.first?.duration ?? 0) as Decimal
-            let indefinite = fetchedPercent.first?.indefinite ?? false
-            let addedMinutes = Int(duration)
-            let date = fetchedPercent.first?.date ?? Date()
-            if date.addingTimeInterval(addedMinutes.minutes.timeInterval) > Date() || indefinite {
-                display.toggle()
-            }
-
-            if fetchedPercent.first?.enabled ?? false, !(fetchedPercent.first?.isPreset ?? false), display {
-                profileString = NSLocalizedString("Custom Profile", comment: "Custom but unsaved Profile")
-            } else if !(fetchedPercent.first?.enabled ?? false) || !display {
-                profileString = NSLocalizedString("Normal Profile", comment: "Your normal Profile. Use a short string")
-            } else {
-                let id_ = fetchedPercent.first?.id ?? ""
-                let profile = fetchedProfiles.filter({ $0.id == id_ }).first
-                if profile != nil {
-                    profileString = profile?.name?.description ?? ""
-                }
-            }
-            return (name: profileString, isOn: display)
-        }
-
         func highlightButtons() {
             for i in 0 ..< timeButtons.count {
                 timeButtons[i].active = timeButtons[i].hours == state.hours
@@ -439,12 +381,11 @@ extension Home {
         }
 
         @ViewBuilder private func bottomPanel(_: GeometryProxy) -> some View {
-            let colorRectangle: Color = colorScheme == .dark ? Color.black.opacity(0.8) : Color.white
             let colorIcon: Color = (colorScheme == .dark ? Color.white : Color.black).opacity(0.9)
 
             ZStack {
                 Rectangle()
-                    .fill(colorRectangle)
+                    .fill(Color("Chart"))
                     .frame(height: UIScreen.main.bounds.height / 13)
                     .cornerRadius(15)
                     .shadow(
@@ -509,10 +450,6 @@ extension Home {
                         .buttonStyle(.borderless)
                         Spacer()
                     }
-
-                    // MARK: CANCEL OF PROFILE HAS TO BE IMPLEMENTED
-
-                    // MAYBE WITH A SMALL INDICATOR AT THE SYMBOL
                     Button {
                         state.showModal(for: .overrideProfilesConfig)
                     } label: {
@@ -591,9 +528,7 @@ extension Home {
 
         @ViewBuilder func bolusProgressView(_: GeometryProxy, _ progress: Decimal) -> some View {
             let colorRectangle: Color = colorScheme == .dark ? Color(
-                red: 0.05490196078,
-                green: 0.05490196078,
-                blue: 0.05490196078
+                "Chart"
             ) : Color.white
 
             let colorIcon = (colorScheme == .dark ? Color.white : Color.black).opacity(0.9)
@@ -750,9 +685,7 @@ extension Home {
 
         @ViewBuilder func profileView(_: GeometryProxy) -> some View {
             let colourChart: Color = colorScheme == .dark ? Color(
-                red: 0.05490196078,
-                green: 0.05490196078,
-                blue: 0.05490196078
+                "Chart"
             ) : .white
 
             if let overrideString = overrideString {
@@ -822,25 +755,6 @@ extension Home {
         }
 
         var body: some View {
-            let colorBackground = colorScheme == .dark ? LinearGradient(
-                            gradient: Gradient(colors: [
-                                // RGB(10, 34, 55)
-                                Color(red: 0.03921568627, green: 0.1333333333, blue: 0.2156862745),
-                                // RGB(3, 15, 28)
-                                Color(red: 0.011, green: 0.058, blue: 0.109),
-                                // RGB(10, 34, 55)
-                                Color(red: 0.03921568627, green: 0.1333333333, blue: 0.2156862745)
-                            ]),
-                            startPoint: .top,
-                            endPoint: .bottom
-                        )
-                            :
-                            LinearGradient(gradient: Gradient(colors: [Color.gray.opacity(0.1)]), startPoint: .top, endPoint: .bottom)
-            let colourChart: Color = colorScheme == .dark ? Color(
-                red: 0.05490196078,
-                green: 0.05490196078,
-                blue: 0.05490196078
-            ) : .white
             GeometryReader { geo in
                 VStack(spacing: 0) {
                     Spacer()
@@ -872,7 +786,7 @@ extension Home {
                     profileView(geo).padding(.vertical)
 
                     RoundedRectangle(cornerRadius: 15)
-                        .fill(colourChart)
+                        .fill(Color("Chart"))
                         .overlay(mainChart)
                         .clipShape(RoundedRectangle(cornerRadius: 15))
                         .shadow(
@@ -897,7 +811,7 @@ extension Home {
                         }
                     }
                 }
-                .background(colorBackground)
+                .background(color)
                 .edgesIgnoringSafeArea(.all)
             }
             .onChange(of: state.hours) { _ in
@@ -917,9 +831,7 @@ extension Home {
                     .background(
                         RoundedRectangle(cornerRadius: 8, style: .continuous)
                             .fill(colorScheme == .dark ? Color(
-                                red: 0.05490196078,
-                                green: 0.05490196078,
-                                blue: 0.05490196078
+                                "Chart"
                             ) : Color(UIColor.darkGray))
                     )
                     .onTapGesture {

+ 12 - 10
FreeAPS/Sources/Modules/OverrideProfilesConfig/View/OverrideProfilesRootView.swift

@@ -41,22 +41,24 @@ extension OverrideProfilesConfig {
             formatter.roundingMode = .halfUp
             return formatter
         }
-        
+
         private var color: LinearGradient {
-            colorScheme == .dark ?  LinearGradient(
+            colorScheme == .dark ? LinearGradient(
                 gradient: Gradient(colors: [
-                    // RGB(10, 34, 55)
-                    Color(red: 0.03921568627, green: 0.1333333333, blue: 0.2156862745),
-                    // RGB(3, 15, 28)
-                    Color(red: 0.011, green: 0.058, blue: 0.109),
-                    // RGB(10, 34, 55)
-                    Color(red: 0.03921568627, green: 0.1333333333, blue: 0.2156862745)
+                    Color("Background_1"),
+                    Color("Background_1"),
+                    Color("Background_2"),
+                    Color("Background_1")
                 ]),
                 startPoint: .top,
                 endPoint: .bottom
             )
                 :
-                LinearGradient(gradient: Gradient(colors: [Color.gray.opacity(0.1)]), startPoint: .top, endPoint: .bottom)
+                LinearGradient(
+                    gradient: Gradient(colors: [Color.gray.opacity(0.1)]),
+                    startPoint: .top,
+                    endPoint: .bottom
+                )
         }
 
         var presetPopover: some View {
@@ -305,7 +307,7 @@ extension OverrideProfilesConfig {
                 .onAppear(perform: configureView)
                 .onAppear { state.savedSettings() }
                 .navigationBarTitle("Profiles")
-                .navigationBarTitleDisplayMode(.automatic)
+                .navigationBarTitleDisplayMode(.inline)
                 .navigationBarItems(trailing: Button("Close", action: state.hideModal))
         }
 

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

@@ -9,22 +9,24 @@ extension Settings {
         @State private var showShareSheet = false
 
         @Environment(\.colorScheme) var colorScheme
-        
+
         private var color: LinearGradient {
-            colorScheme == .dark ?  LinearGradient(
+            colorScheme == .dark ? LinearGradient(
                 gradient: Gradient(colors: [
-                    // RGB(10, 34, 55)
-                    Color(red: 0.03921568627, green: 0.1333333333, blue: 0.2156862745),
-                    // RGB(3, 15, 28)
-                    Color(red: 0.011, green: 0.058, blue: 0.109),
-                    // RGB(10, 34, 55)
-                    Color(red: 0.03921568627, green: 0.1333333333, blue: 0.2156862745)
+                    Color("Background_1"),
+                    Color("Background_1"),
+                    Color("Background_2"),
+                    Color("Background_1")
                 ]),
                 startPoint: .top,
                 endPoint: .bottom
             )
                 :
-                LinearGradient(gradient: Gradient(colors: [Color.gray.opacity(0.1)]), startPoint: .top, endPoint: .bottom)
+                LinearGradient(
+                    gradient: Gradient(colors: [Color.gray.opacity(0.1)]),
+                    startPoint: .top,
+                    endPoint: .bottom
+                )
         }
 
         var body: some View {

+ 11 - 9
FreeAPS/Sources/Modules/Stat/View/StatRootView.swift

@@ -36,22 +36,24 @@ extension Stat {
         @State var days: Double = 0
         @State var pointSize: CGFloat = 3
         @State var conversionFactor = 0.0555
-        
+
         private var color: LinearGradient {
-            colorScheme == .dark ?  LinearGradient(
+            colorScheme == .dark ? LinearGradient(
                 gradient: Gradient(colors: [
-                    // RGB(10, 34, 55)
-                    Color(red: 0.03921568627, green: 0.1333333333, blue: 0.2156862745),
-                    // RGB(3, 15, 28)
-                    Color(red: 0.011, green: 0.058, blue: 0.109),
-                    // RGB(10, 34, 55)
-                    Color(red: 0.03921568627, green: 0.1333333333, blue: 0.2156862745)
+                    Color("Background_1"),
+                    Color("Background_1"),
+                    Color("Background_2"),
+                    Color("Background_1")
                 ]),
                 startPoint: .top,
                 endPoint: .bottom
             )
                 :
-                LinearGradient(gradient: Gradient(colors: [Color.gray.opacity(0.1)]), startPoint: .top, endPoint: .bottom)
+                LinearGradient(
+                    gradient: Gradient(colors: [Color.gray.opacity(0.1)]),
+                    startPoint: .top,
+                    endPoint: .bottom
+                )
         }
 
         @ViewBuilder func stats() -> some View {

+ 1 - 1
FreeAPS/Sources/Modules/StatConfig/View/StatConfigRootView.swift

@@ -66,7 +66,7 @@ extension StatConfig {
                         }
                     }
                 } header: { Text("History Settings") }
-                
+
                 Section {
                     Picker(
                         selection: $state.lockScreenView,

+ 2 - 2
FreeAPS/Sources/Services/LiveActivity/LiveActivityBridge.swift

@@ -91,7 +91,7 @@ extension LiveActivityAttributes.ContentState {
         let iob = suggestion.iob ?? 0
 
         let lockScreenView = settings.lockScreenView.displayName
-        
+
         self.init(
             bg: formattedBG,
             trendSystemImage: trendString,
@@ -149,7 +149,7 @@ extension LiveActivityAttributes.ContentState {
     init(resolver: Resolver) {
         injectServices(resolver)
         broadcaster.register(GlucoseObserver.self, observer: self)
-        
+
         Foundation.NotificationCenter.default.addObserver(
             forName: UIApplication.didEnterBackgroundNotification,
             object: nil,

+ 14 - 14
LiveActivity/LiveActivity.swift

@@ -150,20 +150,20 @@ struct LiveActivity: Widget {
             // Lock screen/banner UI goes here
             if context.state.lockScreenView == "Simple" {
                 HStack(spacing: 3) {
-                   bgAndTrend(context: context).font(.title)
-                   Spacer()
-                   VStack(alignment: .trailing, spacing: 5) {
-                       changeLabel(context: context).font(.title3)
-                       updatedLabel(context: context).font(.caption).foregroundStyle(.black.opacity(0.7))
-                   }
-               }
-               .privacySensitive()
-               .imageScale(.small)
-               .padding(.all, 15)
-               .background(Color.white.opacity(0.2))
-               .foregroundColor(Color.black)
-               .activityBackgroundTint(Color.cyan.opacity(0.2))
-               .activitySystemActionForegroundColor(Color.black)
+                    bgAndTrend(context: context).font(.title)
+                    Spacer()
+                    VStack(alignment: .trailing, spacing: 5) {
+                        changeLabel(context: context).font(.title3)
+                        updatedLabel(context: context).font(.caption).foregroundStyle(.black.opacity(0.7))
+                    }
+                }
+                .privacySensitive()
+                .imageScale(.small)
+                .padding(.all, 15)
+                .background(Color.white.opacity(0.2))
+                .foregroundColor(Color.black)
+                .activityBackgroundTint(Color.cyan.opacity(0.2))
+                .activitySystemActionForegroundColor(Color.black)
             } else {
                 HStack(spacing: 2) {
                     VStack {