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 {