KontoKarte: Ampelfarbe als Color fuer den Text
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user