Additional color cleanup

This commit is contained in:
Garth Vander Houwen 2023-03-31 18:49:30 -07:00
parent 0ba5846eda
commit 6dc7abc42c
6 changed files with 29 additions and 14 deletions

View file

@ -88,21 +88,38 @@ extension Int {
}
}
extension Int64 {
func uiColor() -> UIColor {
let color = UIColor(
red: CGFloat((self & 0xFF0000) >> 16) / 255.0,
green: CGFloat((self & 0x00FF00) >> 8) / 255.0,
blue: CGFloat(self & 0x0000FF) / 255.0,
red: CGFloat((UInt32(self) & 0xFF0000) >> 16) / 255.0,
green: CGFloat((UInt32(self) & 0x00FF00) >> 8) / 255.0,
blue: CGFloat(UInt32(self) & 0x0000FF) / 255.0,
alpha: CGFloat(1.0))
return color
}
}
//extension Int64 {
//
// func uiColor() -> UIColor {
//
// let bytes = withUnsafeBytes(of: UInt32(self).littleEndian, Array.init)
// let redBytes = bytes[0]
// let greenBytes = bytes[1]
// let blueBytes = bytes[2]
// let color = UIColor(
//
// red: CGFloat(redBytes),
// green: CGFloat(greenBytes),
// blue: CGFloat(blueBytes),
// alpha: CGFloat(1.0))
//
// return color
// }
//}
extension UIImage {
func rotate(radians: Float) -> UIImage? {
var newSize = CGRect(origin: CGPoint.zero, size: self.size).applying(CGAffineTransform(rotationAngle: CGFloat(radians))).size

View file

@ -45,7 +45,7 @@ struct Contacts: View {
let currentDay = Calendar.current.dateComponents([.day], from: Date()).day ?? 0
VStack(alignment: .leading) {
HStack {
CircleText(text: String(channel.index), color: .accentColor, circleSize: 52, fontSize: 40, brightness: 0.1)
CircleText(text: String(channel.index), color: .accentColor, circleSize: 60, fontSize: 42, brightness: 0.1)
.padding(.trailing, 5)
VStack {
HStack {
@ -150,7 +150,7 @@ struct Contacts: View {
HStack {
VStack {
HStack {
CircleText(text: user.shortName ?? "???", color: Color(user.num.uiColor()), circleSize: 52, fontSize: 16, textColor: user.num.uiColor().isLight() ? .black : .white)
CircleText(text: user.shortName ?? "???", color: Color(user.num.uiColor()), circleSize: 60, fontSize: 18, textColor: user.num.uiColor().isLight() ? .black : .white)
.padding(.trailing, 5)
VStack {
HStack {

View file

@ -360,7 +360,7 @@ struct UserMessageList: View {
.toolbar {
ToolbarItem(placement: .principal) {
HStack {
CircleText(text: user.shortName ?? "???", color: .accentColor, circleSize: 44, fontSize: 14).fixedSize()
CircleText(text: user.shortName ?? "???", color: Color(user.num.uiColor()), circleSize: 44, fontSize: 14, textColor: user.num.uiColor().isLight() ? .black : .white ).fixedSize()
Text(user.longName ?? NSLocalizedString("unknown", comment: "Unknown")).font(.headline)
}
}

View file

@ -259,7 +259,7 @@ struct NodeDetail: View {
HStack {
VStack(alignment: .center) {
CircleText(text: node.user?.shortName ?? "???", color: .accentColor)
CircleText(text: node.user?.shortName ?? "???", color: Color(node.num.uiColor()), textColor: node.num.uiColor().isLight() ? .black : .white )
}
Divider()
VStack {

View file

@ -26,8 +26,6 @@ struct NodeList: View {
@State private var selection: NodeInfoEntity? // Nothing selected by default.
var body: some View {
NavigationSplitView {
List(nodes, id: \.self, selection: $selection) { node in
@ -38,7 +36,7 @@ struct NodeList: View {
let connected: Bool = (bleManager.connectedPeripheral != nil && bleManager.connectedPeripheral?.num ?? -1 == node.num)
VStack(alignment: .leading) {
HStack {
CircleText(text: node.user?.shortName ?? "???", color: Color(node.num.uiColor()), circleSize: 52, fontSize: 16, brightness: 0.0, textColor: node.num.uiColor().isLight() ? .black : .white)
CircleText(text: node.user?.shortName ?? "???", color: Color(node.num.uiColor()), circleSize: 65, fontSize: 20, brightness: 0.0, textColor: node.num.uiColor().isLight() ? .black : .white)
.padding(.trailing, 5)
VStack(alignment: .leading) {
Text(node.user?.longName ?? NSLocalizedString("unknown", comment: "Unknown")).font(.headline)

View file

@ -51,7 +51,7 @@
"config.save.confirm"="After config values save the node will reboot.";
"communicating"="Communicating with device. .";
"connected.radio"="Connected Radio";
"connected"="Currently Connected";
"connected"="Connected";
"connecting"="Connecting . .";
"contacts"="Contacts";
"copy"="Copy";