mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Color
This commit is contained in:
parent
069bc1f11b
commit
f135519ac1
2 changed files with 14 additions and 14 deletions
|
|
@ -18,49 +18,49 @@ struct BatteryCompact: View {
|
|||
Image(systemName: "battery.100.bolt")
|
||||
.font(iconFont)
|
||||
.foregroundColor(color)
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
.symbolRenderingMode(.multicolor)
|
||||
} else if batteryLevel < 100 && batteryLevel > 74 {
|
||||
Image(systemName: "battery.75")
|
||||
.font(iconFont)
|
||||
.foregroundColor(color)
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
.symbolRenderingMode(.multicolor)
|
||||
} else if batteryLevel < 75 && batteryLevel > 49 {
|
||||
Image(systemName: "battery.50")
|
||||
.font(iconFont)
|
||||
.foregroundColor(color)
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
.symbolRenderingMode(.multicolor)
|
||||
} else if batteryLevel < 50 && batteryLevel > 14 {
|
||||
Image(systemName: "battery.25")
|
||||
.font(iconFont)
|
||||
.foregroundColor(color)
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
.symbolRenderingMode(.multicolor)
|
||||
} else if batteryLevel < 15 && batteryLevel > 0 {
|
||||
Image(systemName: "battery.0")
|
||||
.font(iconFont)
|
||||
.foregroundColor(color)
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
.symbolRenderingMode(.multicolor)
|
||||
} else if batteryLevel == 0 {
|
||||
Image(systemName: "battery.0")
|
||||
.font(iconFont)
|
||||
.foregroundColor(.red)
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
.symbolRenderingMode(.multicolor)
|
||||
} else if batteryLevel > 100 {
|
||||
Image(systemName: "powerplug")
|
||||
.font(iconFont)
|
||||
.foregroundColor(color)
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
.symbolRenderingMode(.multicolor)
|
||||
}
|
||||
if batteryLevel > 100 {
|
||||
Text("PWD")
|
||||
.foregroundStyle(.gray)
|
||||
.foregroundStyle(.secondary)
|
||||
.font(font)
|
||||
} else if batteryLevel == 100 {
|
||||
Text("CHG")
|
||||
.foregroundStyle(.gray)
|
||||
.foregroundStyle(.secondary)
|
||||
.font(font)
|
||||
} else {
|
||||
Text("\(batteryLevel)%")
|
||||
.foregroundStyle(.gray)
|
||||
.foregroundStyle(.secondary)
|
||||
.font(font)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -107,17 +107,15 @@ struct DeviceMetricsLog: View {
|
|||
Spacer()
|
||||
Image(systemName: "bolt")
|
||||
.symbolRenderingMode(.multicolor)
|
||||
.foregroundStyle(.yellow)
|
||||
Text("Voltage \(String(format: "%.2f", dm.voltage)) ")
|
||||
.foregroundStyle(.gray)
|
||||
BatteryCompact(batteryLevel: dm.batteryLevel, font: .caption, iconFont: .callout, color: .accentColor)
|
||||
}
|
||||
.font(.caption)
|
||||
HStack {
|
||||
Text("Channel Utilization \(String(format: "%.2f", dm.channelUtilization))% ")
|
||||
.foregroundColor(dm.channelUtilization < 25 ? .gray : (dm.channelUtilization > 50 ? .red : .orange))
|
||||
.foregroundColor(dm.channelUtilization < 25 ? .secondary : (dm.channelUtilization > 50 ? .red : .orange))
|
||||
Text("Airtime \(String(format: "%.2f", dm.airUtilTx))%")
|
||||
.foregroundColor(.gray)
|
||||
.foregroundColor(.secondary)
|
||||
Spacer()
|
||||
}
|
||||
.font(.caption)
|
||||
|
|
@ -139,6 +137,7 @@ struct DeviceMetricsLog: View {
|
|||
}
|
||||
TableColumn("channel.utilization") { dm in
|
||||
Text("\(String(format: "%.2f", dm.channelUtilization))%")
|
||||
.foregroundColor(dm.channelUtilization < 25 ? .secondary : (dm.channelUtilization > 50 ? .red : .orange))
|
||||
}
|
||||
TableColumn("airtime") { dm in
|
||||
Text("\(String(format: "%.2f", dm.airUtilTx))%")
|
||||
|
|
@ -149,6 +148,7 @@ struct DeviceMetricsLog: View {
|
|||
let components = (now..<later).formatted(.components(style: .narrow))
|
||||
Text(components)
|
||||
}
|
||||
.width(min: 100)
|
||||
TableColumn("timestamp") { dm in
|
||||
Text(dm.time?.formattedDate(format: dateFormatString) ?? "unknown.age".localized)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue