Merge pull request #245 from meshtastic/2.0.3_Working_Changes

Add brightness control to circle text to try and manage sidebar color…
This commit is contained in:
Garth Vander Houwen 2022-11-20 16:39:02 -08:00 committed by GitHub
commit 205e429df9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 6 deletions

View file

@ -10,6 +10,7 @@ struct CircleText: View {
var color: Color
var circleSize: CGFloat? = 60
var fontSize: CGFloat? = 20
var brightness: Double? = 0
var body: some View {
@ -18,6 +19,7 @@ struct CircleText: View {
ZStack {
Circle()
.fill(color)
.brightness(brightness ?? 0)
.frame(width: circleSize, height: circleSize)
Text(text).textCase(.uppercase).font(font).foregroundColor(.white).fixedSize()
.frame(width: circleSize, height: circleSize, alignment: /*@START_MENU_TOKEN@*/.center/*@END_MENU_TOKEN@*/).offset(x: 0, y: 0)

View file

@ -41,7 +41,7 @@ struct Contacts: View {
let currentDay = Calendar.current.dateComponents([.day], from: Date()).day ?? 0
VStack(alignment: .leading) {
HStack {
CircleText(text: String(channel.index), color: .gray, circleSize: 52, fontSize: 40)
CircleText(text: String(channel.index), color: .accentColor, circleSize: 52, fontSize: 40, brightness: 0.1)
.padding(.trailing, 5)
VStack {
HStack {
@ -98,7 +98,7 @@ struct Contacts: View {
HStack {
VStack {
HStack {
CircleText(text: user.shortName ?? "???", color: .gray, circleSize: 52, fontSize: 16)
CircleText(text: user.shortName ?? "???", color: .accentColor, circleSize: 52, fontSize: 16, brightness: 0.1)
.padding(.trailing, 5)
VStack {
HStack {

View file

@ -42,16 +42,17 @@ struct NodeList: View {
let connected: Bool = (bleManager.connectedPeripheral != nil && bleManager.connectedPeripheral.num == node.num)
VStack(alignment: .leading) {
HStack {
CircleText(text: node.user?.shortName ?? "???", color: .gray, circleSize: 52, fontSize: 16)
CircleText(text: node.user?.shortName ?? "???", color: .accentColor, circleSize: 52, fontSize: 16, brightness: 0.1)
.padding(.trailing, 5)
VStack(alignment: .leading) {
Text(node.user?.longName ?? "Unknown").font(.headline)
if connected {
HStack(alignment: .bottom) {
Image(systemName: "repeat.circle.fill")
.font(.title2)
.font(.title3)
.symbolRenderingMode(.hierarchical)
Text("Currently Connected").font(.callout)
Text("Currently Connected").font(.subheadline)
.foregroundColor(.green)
}
}
if node.positions?.count ?? 0 > 0 && (bleManager.connectedPeripheral != nil && bleManager.connectedPeripheral.num != node.num) {
@ -71,7 +72,7 @@ struct NodeList: View {
}
HStack(alignment: .bottom) {
Image(systemName: "clock.badge.checkmark.fill")
.font(.headline)
.font(.title3)
.symbolRenderingMode(.hierarchical)
LastHeardText(lastHeard: node.lastHeard)
.font(.subheadline)