Преглед изворни кода

small UI color fixes for darkmode

polscm32 пре 2 година
родитељ
комит
de8cd9336e

+ 10 - 15
FreeAPS/Sources/Modules/Home/View/Header/CurrentGlucoseView.swift

@@ -89,7 +89,7 @@ struct CurrentGlucoseView: View {
                                 NSLocalizedString("min", comment: "Short form for minutes") + " "
                         )
                     )
-                    .font(.caption2).foregroundColor(.secondary)
+                    .font(.caption2).foregroundColor(colorScheme == .dark ? Color.white.opacity(0.9) : Color.secondary)
 
                     Text(
                         delta
@@ -97,7 +97,7 @@ struct CurrentGlucoseView: View {
                                 deltaFormatter.string(from: Double(units == .mmolL ? $0.asMmolL : Decimal($0)) as NSNumber)!
                             } ?? "--"
                     )
-                    .font(.caption2).foregroundColor(.secondary)
+                    .font(.caption2).foregroundColor(colorScheme == .dark ? Color.white.opacity(0.9) : Color.secondary)
                 }.frame(alignment: .top)
             }
         }
@@ -108,35 +108,28 @@ struct CurrentGlucoseView: View {
                      .singleUp,
                      .tripleUp:
                     rotationDegrees = -90
-                    angularGradient
 
                 case .fortyFiveUp:
                     rotationDegrees = -45
-                    angularGradient
 
                 case .flat:
                     rotationDegrees = 0
-                    angularGradient
 
                 case .fortyFiveDown:
                     rotationDegrees = 45
-                    angularGradient
 
                 case .doubleDown,
                      .singleDown,
                      .tripleDown:
                     rotationDegrees = 90
-                    angularGradient
 
                 case .none,
                      .notComputable,
                      .rateOutOfRange:
                     rotationDegrees = 0
-                    angularGradient
 
                 @unknown default:
                     rotationDegrees = 0
-                    angularGradient
                 }
             }
         }
@@ -177,6 +170,8 @@ struct Triangle: Shape {
 }
 
 struct TrendShape: View {
+    @Environment(\.colorScheme) var colorScheme
+
     let gradient: AngularGradient
     let color: Color
 
@@ -184,6 +179,7 @@ struct TrendShape: View {
         HStack(alignment: .center) {
             ZStack {
                 CircleShape(gradient: gradient)
+                    .shadow(color: Color.black.opacity(colorScheme == .dark ? 0.75 : 0.33), radius: colorScheme == .dark ? 5 : 3)
                 TriangleShape(color: color)
             }
         }
@@ -196,15 +192,14 @@ struct CircleShape: View {
     let gradient: AngularGradient
 
     var body: some View {
-        let colorBackground: Color = colorScheme == .dark ? .black.opacity(0.8) : .white
+        let colorBackground: Color = colorScheme == .dark ? Color(
+            red: 0.05490196078,
+            green: 0.05490196078,
+            blue: 0.05490196078
+        ) : .white
 
         Circle()
             .stroke(gradient, lineWidth: 10)
-            .shadow(
-                color: colorScheme == .dark ? Color(red: 0.02745098039, green: 0.1098039216, blue: 0.1411764706) :
-                    Color.black.opacity(0.33),
-                radius: 3
-            )
             .background(Circle().fill(colorBackground))
             .frame(width: 110, height: 110)
     }

+ 7 - 8
FreeAPS/Sources/Modules/Home/View/HomeRootView.swift

@@ -452,13 +452,8 @@ extension Home {
                 }
             }
             .shadow(
-                color: colorScheme == .dark ? Color(
-                    red: 0.02745098039,
-                    green: 0.1098039216,
-                    blue: 0.1411764706
-                ) : Color
-                    .black.opacity(0.33),
-                radius: 3
+                color: Color.black.opacity(colorScheme == .dark ? 0.75 : 0.33),
+                radius: colorScheme == .dark ? 5 : 3
             )
             .font(buttonFont)
         }
@@ -747,7 +742,11 @@ extension Home {
                     .padding()
                     .background(
                         RoundedRectangle(cornerRadius: 8, style: .continuous)
-                            .fill(Color(UIColor.darkGray))
+                            .fill(colorScheme == .dark ? Color(
+                                red: 0.05490196078,
+                                green: 0.05490196078,
+                                blue: 0.05490196078
+                            ) : Color(UIColor.darkGray))
                     )
                     .onTapGesture {
                         isStatusPopupPresented = false