From c74e6166bf5aae9d8cf1a82e5a1ac9f52baf71a1 Mon Sep 17 00:00:00 2001 From: Tony Bark <35226681+tonytins@users.noreply.github.com> Date: Sun, 23 Aug 2026 21:46:15 -0400 Subject: [PATCH] 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. --- Sources/AmtrakStatus/ContentView.swift | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Sources/AmtrakStatus/ContentView.swift b/Sources/AmtrakStatus/ContentView.swift index 2643cc8..abd3a0d 100644 --- a/Sources/AmtrakStatus/ContentView.swift +++ b/Sources/AmtrakStatus/ContentView.swift @@ -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 {