mirror of
https://github.com/tonytins/amtkstat.git
synced 2026-10-24 05:32:54 -04:00
Fix status text contrast on green rows
Green status rows used white text, which was difficult to read against the green background. This change selects a contrasting text color based on the status color so green rows use black text and other statuses keep white text for better legibility in the status table.
This commit is contained in:
parent
915d0ec2dc
commit
c74e6166bf
1 changed files with 12 additions and 1 deletions
|
|
@ -60,7 +60,9 @@ struct ContentView: View {
|
|||
RoundedRectangle(cornerRadius: 0)
|
||||
.fill(row.status.color)
|
||||
Text(row.status.descrption)
|
||||
.foregroundColor(Color.white)
|
||||
.foregroundColor(
|
||||
statusColour(row.status.color)
|
||||
)
|
||||
}
|
||||
}
|
||||
TableColumn("Track", value: \TrainStatusRow.platform)
|
||||
|
|
@ -92,6 +94,15 @@ struct ContentView: View {
|
|||
var normalizedStationCode: String {
|
||||
stationCode.trimmingCharacters(in: .whitespacesAndNewlines).uppercased()
|
||||
}
|
||||
|
||||
func statusColour(_ color: Color) -> Color {
|
||||
switch color {
|
||||
case .green:
|
||||
return .black
|
||||
default:
|
||||
return .white
|
||||
}
|
||||
}
|
||||
|
||||
func loadTrainStatus(forStationCode code: String) async {
|
||||
guard !code.isEmpty else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue