Skip to content

Commit 1535293

Browse files
committed
- Some quick UI color stuff -- I hadn't seen it in light mode yet and noticed some pretty glaring issues!
1 parent dbb598a commit 1535293

5 files changed

Lines changed: 42 additions & 45 deletions

File tree

Infini-iOS/Utilities/ColorPalette.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@ import SwiftUI
1313
extension Color {
1414
static let darkGray = Color(red: 50 / 255, green: 50 / 255, blue: 50 / 255)
1515
static let darkestGray = Color(red: 25 / 255, green: 25 / 255, blue: 25 / 255)
16+
static let lightGray = Color(red: 200 / 255, green: 200 / 255, blue: 200 / 255)
17+
1618
}

Infini-iOS/View Components/BLEStatusView.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import SwiftUI
1111
struct StatusView: View {
1212

1313
@EnvironmentObject var bleManager: BLEManager
14+
@Environment(\.colorScheme) var colorScheme
1415

1516
var body: some View {
1617
VStack (spacing: 10){
@@ -30,7 +31,7 @@ struct StatusView: View {
3031
.padding()
3132
.padding(.vertical, 7)
3233
.frame(maxWidth: .infinity, alignment: .center)
33-
.background(Color.gray)
34+
.background(colorScheme == .dark ? Color.darkGray : Color.gray)
3435
.foregroundColor(Color.white)
3536
.cornerRadius(10)
3637
.padding(.horizontal, 20)
@@ -41,8 +42,8 @@ struct StatusView: View {
4142
.padding()
4243
.padding(.vertical, 7)
4344
.frame(maxWidth: .infinity, alignment: .center)
44-
.background(Color.darkGray)
45-
.foregroundColor(Color.gray)
45+
.background(colorScheme == .dark ? Color.gray : Color.lightGray)
46+
.foregroundColor(colorScheme == .dark ? Color.gray : Color.white)
4647
.cornerRadius(10)
4748
.padding(.horizontal, 20)
4849
.padding(.bottom)

Infini-iOS/View Components/DFU/DFUView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ struct DFUView: View {
9292
.padding()
9393
.padding(.vertical, 7)
9494
.frame(maxWidth: .infinity, alignment: .center)
95-
.background(firmwareSelected ? Color.gray : Color.darkGray)
95+
.background(colorScheme == .dark ? (firmwareSelected ? Color.darkGray : Color.darkestGray) : (firmwareSelected ? Color.gray : Color.lightGray))
9696
.foregroundColor(firmwareSelected ? Color.white : Color.gray)
9797
.cornerRadius(10)
9898
.padding(.horizontal, 20)
@@ -108,7 +108,7 @@ struct DFUView: View {
108108
.padding()
109109
.padding(.vertical, 7)
110110
.frame(maxWidth: .infinity, alignment: .center)
111-
.background(firmwareSelected ? Color.gray : Color.darkGray)
111+
.background(colorScheme == .dark ? (firmwareSelected ? Color.darkGray : Color.darkestGray) : (firmwareSelected ? Color.gray : Color.lightGray))
112112
.foregroundColor(firmwareSelected ? Color.white : Color.gray)
113113
.cornerRadius(10)
114114
.padding(.horizontal, 20)

Infini-iOS/View Components/SideMenu.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ struct SideMenu: View {
7777
VStack (alignment: .center, spacing:10) {
7878
Text("STATUS")
7979
.font(.headline)
80+
.foregroundColor(Color.gray)
8081

8182

8283
if bleManager.isSwitchedOn {

Infini-iOS/View Components/Status View Components/StatusViewTabs.swift

Lines changed: 33 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -14,53 +14,46 @@ struct StatusTabs: View {
1414

1515
@EnvironmentObject var bleManager: BLEManager
1616
@State var trueIfHeart = true
17-
17+
@State var trueIfBat = false
18+
@Environment(\.colorScheme) var colorScheme
19+
1820
var body: some View{
1921
VStack {
20-
if !bleManager.isConnectedToPinetime {
21-
Text("Disconnected")
22-
.foregroundColor(Color.white)
22+
HStack {
23+
Button (action: {
24+
self.trueIfHeart = true
25+
self.trueIfBat = false
26+
}) {
27+
(Text(Image(systemName: "heart"))
28+
.foregroundColor(Color.pink) +
29+
Text(": " + String(format: "%.0f", bleManager.heartBPM))
30+
.foregroundColor(Color.white))
31+
.frame(maxWidth:.infinity, alignment: .center)
32+
.padding()
33+
.background(colorScheme == .dark ? (trueIfHeart ? Color.darkGray : Color.darkestGray) : (trueIfHeart ? Color.gray : Color.lightGray))
34+
.cornerRadius(5)
35+
.font(.title)
36+
}.padding(.leading, 10)
37+
Button (action: {
38+
self.trueIfHeart = false
39+
self.trueIfBat = true
40+
}) {
41+
(Text(Image(systemName: "battery.100"))
42+
.foregroundColor(Color.green) +
43+
Text(": " + String(format: "%.0f", bleManager.batteryLevel))
44+
.foregroundColor(Color.white))
2345
.frame(maxWidth: .infinity, alignment: .center)
2446
.padding()
25-
.background(Color.darkGray)
47+
.background(colorScheme == .dark ? (trueIfBat ? Color.darkGray : Color.darkestGray) : (trueIfBat ? Color.gray : Color.lightGray))
2648
.cornerRadius(5)
2749
.font(.title)
28-
.padding(.horizontal, 10)
29-
} else {
30-
HStack {
31-
Button (action: {
32-
self.trueIfHeart = true
33-
}) {
34-
(Text(Image(systemName: "heart"))
35-
.foregroundColor(Color.pink) +
36-
Text(": " + String(format: "%.0f", bleManager.heartBPM))
37-
.foregroundColor(Color.white))
38-
.frame(maxWidth:.infinity, alignment: .center)
39-
.padding()
40-
.background(trueIfHeart ? Color.darkGray : Color.darkestGray)
41-
.cornerRadius(5)
42-
.font(.title)
43-
}.padding(.leading, 10)
44-
Button (action: {
45-
self.trueIfHeart = false
46-
}) {
47-
(Text(Image(systemName: "battery.100"))
48-
.foregroundColor(Color.green) +
49-
Text(": " + String(format: "%.0f", bleManager.batteryLevel))
50-
.foregroundColor(Color.white))
51-
.frame(maxWidth: .infinity, alignment: .center)
52-
.padding()
53-
.background(trueIfHeart ? Color.darkestGray : Color.darkGray)
54-
.cornerRadius(5)
55-
.font(.title)
56-
}
57-
.padding(.trailing, 10)
58-
}
59-
if trueIfHeart {
60-
HeartChart()
61-
} else {
62-
BatteryChart()
6350
}
51+
.padding(.trailing, 10)
52+
}
53+
if trueIfHeart {
54+
HeartChart()
55+
} else {
56+
BatteryChart()
6457
}
6558
}
6659
}

0 commit comments

Comments
 (0)