KontoKarte: Ampelfarbe als Color fuer den Text

This commit is contained in:
2026-12-04 20:56:04 +01:00
parent 710f6960f9
commit 3664caafc2
+10 -1
View File
@@ -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