Skip to content

Commit

Permalink
- Some quick UI color stuff -- I hadn't seen it in light mode yet and…
Browse files Browse the repository at this point in the history
… noticed some pretty glaring issues!
  • Loading branch information
xan-m committed Aug 21, 2021
1 parent dbb598a commit 1535293
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 45 deletions.
2 changes: 2 additions & 0 deletions Infini-iOS/Utilities/ColorPalette.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ import SwiftUI
extension Color {
static let darkGray = Color(red: 50 / 255, green: 50 / 255, blue: 50 / 255)
static let darkestGray = Color(red: 25 / 255, green: 25 / 255, blue: 25 / 255)
static let lightGray = Color(red: 200 / 255, green: 200 / 255, blue: 200 / 255)

}
7 changes: 4 additions & 3 deletions Infini-iOS/View Components/BLEStatusView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import SwiftUI
struct StatusView: View {

@EnvironmentObject var bleManager: BLEManager
@Environment(\.colorScheme) var colorScheme

var body: some View {
VStack (spacing: 10){
Expand All @@ -30,7 +31,7 @@ struct StatusView: View {
.padding()
.padding(.vertical, 7)
.frame(maxWidth: .infinity, alignment: .center)
.background(Color.gray)
.background(colorScheme == .dark ? Color.darkGray : Color.gray)
.foregroundColor(Color.white)
.cornerRadius(10)
.padding(.horizontal, 20)
Expand All @@ -41,8 +42,8 @@ struct StatusView: View {
.padding()
.padding(.vertical, 7)
.frame(maxWidth: .infinity, alignment: .center)
.background(Color.darkGray)
.foregroundColor(Color.gray)
.background(colorScheme == .dark ? Color.gray : Color.lightGray)
.foregroundColor(colorScheme == .dark ? Color.gray : Color.white)
.cornerRadius(10)
.padding(.horizontal, 20)
.padding(.bottom)
Expand Down
4 changes: 2 additions & 2 deletions Infini-iOS/View Components/DFU/DFUView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ struct DFUView: View {
.padding()
.padding(.vertical, 7)
.frame(maxWidth: .infinity, alignment: .center)
.background(firmwareSelected ? Color.gray : Color.darkGray)
.background(colorScheme == .dark ? (firmwareSelected ? Color.darkGray : Color.darkestGray) : (firmwareSelected ? Color.gray : Color.lightGray))
.foregroundColor(firmwareSelected ? Color.white : Color.gray)
.cornerRadius(10)
.padding(.horizontal, 20)
Expand All @@ -108,7 +108,7 @@ struct DFUView: View {
.padding()
.padding(.vertical, 7)
.frame(maxWidth: .infinity, alignment: .center)
.background(firmwareSelected ? Color.gray : Color.darkGray)
.background(colorScheme == .dark ? (firmwareSelected ? Color.darkGray : Color.darkestGray) : (firmwareSelected ? Color.gray : Color.lightGray))
.foregroundColor(firmwareSelected ? Color.white : Color.gray)
.cornerRadius(10)
.padding(.horizontal, 20)
Expand Down
1 change: 1 addition & 0 deletions Infini-iOS/View Components/SideMenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ struct SideMenu: View {
VStack (alignment: .center, spacing:10) {
Text("STATUS")
.font(.headline)
.foregroundColor(Color.gray)


if bleManager.isSwitchedOn {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,53 +14,46 @@ struct StatusTabs: View {

@EnvironmentObject var bleManager: BLEManager
@State var trueIfHeart = true

@State var trueIfBat = false
@Environment(\.colorScheme) var colorScheme

var body: some View{
VStack {
if !bleManager.isConnectedToPinetime {
Text("Disconnected")
.foregroundColor(Color.white)
HStack {
Button (action: {
self.trueIfHeart = true
self.trueIfBat = false
}) {
(Text(Image(systemName: "heart"))
.foregroundColor(Color.pink) +
Text(": " + String(format: "%.0f", bleManager.heartBPM))
.foregroundColor(Color.white))
.frame(maxWidth:.infinity, alignment: .center)
.padding()
.background(colorScheme == .dark ? (trueIfHeart ? Color.darkGray : Color.darkestGray) : (trueIfHeart ? Color.gray : Color.lightGray))
.cornerRadius(5)
.font(.title)
}.padding(.leading, 10)
Button (action: {
self.trueIfHeart = false
self.trueIfBat = true
}) {
(Text(Image(systemName: "battery.100"))
.foregroundColor(Color.green) +
Text(": " + String(format: "%.0f", bleManager.batteryLevel))
.foregroundColor(Color.white))
.frame(maxWidth: .infinity, alignment: .center)
.padding()
.background(Color.darkGray)
.background(colorScheme == .dark ? (trueIfBat ? Color.darkGray : Color.darkestGray) : (trueIfBat ? Color.gray : Color.lightGray))
.cornerRadius(5)
.font(.title)
.padding(.horizontal, 10)
} else {
HStack {
Button (action: {
self.trueIfHeart = true
}) {
(Text(Image(systemName: "heart"))
.foregroundColor(Color.pink) +
Text(": " + String(format: "%.0f", bleManager.heartBPM))
.foregroundColor(Color.white))
.frame(maxWidth:.infinity, alignment: .center)
.padding()
.background(trueIfHeart ? Color.darkGray : Color.darkestGray)
.cornerRadius(5)
.font(.title)
}.padding(.leading, 10)
Button (action: {
self.trueIfHeart = false
}) {
(Text(Image(systemName: "battery.100"))
.foregroundColor(Color.green) +
Text(": " + String(format: "%.0f", bleManager.batteryLevel))
.foregroundColor(Color.white))
.frame(maxWidth: .infinity, alignment: .center)
.padding()
.background(trueIfHeart ? Color.darkestGray : Color.darkGray)
.cornerRadius(5)
.font(.title)
}
.padding(.trailing, 10)
}
if trueIfHeart {
HeartChart()
} else {
BatteryChart()
}
.padding(.trailing, 10)
}
if trueIfHeart {
HeartChart()
} else {
BatteryChart()
}
}
}
Expand Down

0 comments on commit 1535293

Please sign in to comment.