commit e17561c6b2839de6adc6e8cd7179a15c6997d556 parent 1394d4e786e0a4c37e6268fcbc785a94f2289d24 Author: Marc Stibane <marc@taler.net> Date: Mon, 18 Nov 2024 16:03:58 +0100 Colors Diffstat:
11 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/TalerWallet1/Helper/WalletColors.swift b/TalerWallet1/Helper/WalletColors.swift @@ -21,6 +21,13 @@ public struct WalletColors { let gray8 = grouped ? Color(.secondarySystemGroupedBackground) : Color(.secondarySystemBackground) // disabled Back + let attention = Color.red + let confirm = Color.yellow + + // TODO: In Japan, negative is blue, and positive is red + let positive = Color.green + let negative = Color.red + func buttonForeColor(pressed: Bool, disabled: Bool, prominent: Bool = false, balance: Bool = false) -> Color { balance ? Color.primary diff --git a/TalerWallet1/Views/Actions/Banking/QuiteSomeCoins.swift b/TalerWallet1/Views/Actions/Banking/QuiteSomeCoins.swift @@ -83,7 +83,7 @@ struct QuiteSomeCoins: View { Text(coinData.tooMany ? "Amount too big for a single withdrawal!" : coinData.quiteSome ? "Note: It will take quite some time to prepare this amount! Be more patient..." : "Note: It will take some time to prepare this amount. Be patient...") - .foregroundColor(isError || coinData.quiteSome ? .red : .primary) + .foregroundColor(isError || coinData.quiteSome ? WalletColors().attention : .primary) .talerFont(.body) .multilineTextAlignment(.leading) .padding(.vertical, 6) diff --git a/TalerWallet1/Views/Actions/Peer2peer/P2PSubjectV.swift b/TalerWallet1/Views/Actions/Peer2peer/P2PSubjectV.swift @@ -82,7 +82,7 @@ struct P2PSubjectV: View { if label.count > 0 { Text(label) .frame(maxWidth: .infinity, alignment: .trailing) - .foregroundColor(feeIsNotZero ? .red : WalletColors().secondary(colorScheme, colorSchemeContrast)) + .foregroundColor(WalletColors().secondary(colorScheme, colorSchemeContrast)) .talerFont(.body) } } diff --git a/TalerWallet1/Views/HelperViews/AmountV.swift b/TalerWallet1/Views/HelperViews/AmountV.swift @@ -53,7 +53,7 @@ struct AmountV: View { var body: some View { Text(amountStr(currencyInfo)) - .strikethrough(strikethrough, color: .red) + .strikethrough(strikethrough, color: WalletColors().attention) .multilineTextAlignment(.center) .talerFont(large ? .title : .title2) // .fontWeight(large ? .medium : .regular) // @available(iOS 16.0, *) diff --git a/TalerWallet1/Views/HelperViews/BarGraph.swift b/TalerWallet1/Views/HelperViews/BarGraph.swift @@ -91,7 +91,7 @@ struct BarGraph: View { .frame(width: width, height: topHeight) } Rectangle() - .foregroundColor(incoming ? .green : .red) + .foregroundColor(incoming ? WalletColors().positive : WalletColors().negative) .frame(width: width, height: valueColored) if botHeight > 0 { Rectangle() diff --git a/TalerWallet1/Views/HelperViews/Buttons.swift b/TalerWallet1/Views/HelperViews/Buttons.swift @@ -284,8 +284,8 @@ struct TalerButtonStyle: ButtonStyle { .animation(.spring(response: 0.1), value: configuration.isPressed) .disabled(disabled) if hasBadge { - let badgeColor: Color = (badge == CONFIRM_BANK) ? .yellow - : .red + let badgeColor: Color = (badge == CONFIRM_BANK) ? WalletColors().confirm + : WalletColors().attention let badgeV = Image(systemName: badge) .talerFont(.caption) HStack(alignment: .top, spacing: 0) { diff --git a/TalerWallet1/Views/HelperViews/IconBadge.swift b/TalerWallet1/Views/HelperViews/IconBadge.swift @@ -88,8 +88,8 @@ struct IconBadge: View { : CONFIRM_BANK Image(systemName: badgeName) .talerFont(.caption) - .foregroundColor(needsKYC ? .red - : shouldConfirm ? .yellow + .foregroundColor(needsKYC ? WalletColors().attention + : shouldConfirm ? WalletColors().confirm : .clear) } }.accessibilityHidden(true) diff --git a/TalerWallet1/Views/HelperViews/SubjectInputV.swift b/TalerWallet1/Views/HelperViews/SubjectInputV.swift @@ -95,7 +95,7 @@ struct SubjectInputV<TargetView: View>: View { // if insufficient { // Text(insufficientLabel) // .talerFont(.body) -// .foregroundColor(.red) +// .foregroundColor(WalletColors().attention) // .padding(4) // } diff --git a/TalerWallet1/Views/Sheets/ErrorSheet.swift b/TalerWallet1/Views/Sheets/ErrorSheet.swift @@ -81,7 +81,7 @@ struct ErrorSheet: View { .resizable() .frame(width: 50, height: 50) .aspectRatio(contentMode: .fit) - .foregroundStyle(.red) + .foregroundStyle(WalletColors().attention) .padding() Text(title) diff --git a/TalerWallet1/Views/Transactions/TransactionRowView.swift b/TalerWallet1/Views/Transactions/TransactionRowView.swift @@ -80,7 +80,7 @@ struct TransactionRowView: View { let topString = topString() let centerTop = Text(topString ?? EMPTYSTRING) .foregroundColor(textColor) - .strikethrough(!doneOrPending, color: .red) + .strikethrough(!doneOrPending, color: WalletColors().negative) .talerFont(.headline) // .fontWeight(.medium) iOS 16 .padding(.bottom, -2.0) diff --git a/TalerWallet1/Views/Transactions/TransactionsListView.swift b/TalerWallet1/Views/Transactions/TransactionsListView.swift @@ -136,7 +136,7 @@ struct TransactionsArraySliceV: View { } label: { Label("Delete", systemImage: "trash") } - .tint(.red) + .tint(WalletColors().negative) } } else { row