From 3664caafc2b33c7df0d20dd16d61d950fc0fba86 Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Fri, 4 Dec 2026 20:56:04 +0100 Subject: [PATCH] KontoKarte: Ampelfarbe als Color fuer den Text --- mac/Sources/Cockpit/KontoLeiste.swift | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/mac/Sources/Cockpit/KontoLeiste.swift b/mac/Sources/Cockpit/KontoLeiste.swift index 45fe2ec5..a275b56b 100644 --- a/mac/Sources/Cockpit/KontoLeiste.swift +++ b/mac/Sources/Cockpit/KontoLeiste.swift @@ -65,7 +65,7 @@ struct KontoKarte: View { Text(z.titel).font(.caption2.weight(.semibold)).foregroundStyle(.secondary) .frame(width: 108, alignment: .leading) Text(z.wert).font(.caption2.monospacedDigit().weight(.semibold)) - .foregroundStyle(ton(z.farbe)) + .foregroundStyle(farbe(z.farbe)) Text(z.satz).font(.caption2).foregroundStyle(.secondary) .fixedSize(horizontal: false, vertical: true) Spacer(minLength: 0) @@ -74,6 +74,15 @@ struct KontoKarte: View { } } + private func farbe(_ farbe: String) -> Color { + switch farbe { + case "rot": return .red + case "gelb": return .orange + case "gruen": return .green + default: return .secondary + } + } + private func ton(_ farbe: String) -> Ton { switch farbe { case "rot": return .rot