taler-ios

iOS apps for GNU Taler (wallet)
Log | Files | Refs | README | LICENSE

commit ed8806cd39981a044e5813ec067f18c9afa66041
parent 6b94fe0ac80acb4065b09ab12ece09f05f511c31
Author: Marc Stibane <marc@taler.net>
Date:   Fri, 12 Apr 2024 17:46:49 +0200

WalletColors

Diffstat:
MTalerWallet1/Helper/WalletColors.swift | 15++++++++++++++-
MTalerWallet1/Views/Transactions/ThreeAmountsV.swift | 2+-
MTalerWallet1/Views/Transactions/TransactionSummaryV.swift | 4++--
3 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/TalerWallet1/Helper/WalletColors.swift b/TalerWallet1/Helper/WalletColors.swift @@ -44,6 +44,10 @@ public struct WalletColors { : Color(.darkGray) // WCAG AA for light scheme } + var labelColor: Color { + Color(UIColor.label) + } + var backgroundColor: Color { grouped ? Color(.systemGroupedBackground) : Color(.systemBackground) @@ -53,9 +57,15 @@ public struct WalletColors { gray6 } + func pickerSelected(_ scheme: ColorScheme, _ contrast: ColorSchemeContrast) -> Color { + return contrast == .increased ? (scheme == .dark ? gray3 : gray4) + : (scheme == .dark ? gray4 : gray5) + } + var fieldForeground: Color { // text color Color.primary } + var fieldBackground: Color { gray8 } @@ -64,13 +74,16 @@ public struct WalletColors { // used in TransactionRowView gray1 } - func errorColor() -> Color { + + var errorColor: Color { Color("Error") } + func pendingColor(_ incoming: Bool) -> Color { incoming ? Color("PendingIncoming") : Color("PendingOutgoing") } + func transactionColor(_ incoming: Bool) -> Color { incoming ? Color("Incoming") : Color("Outgoing") diff --git a/TalerWallet1/Views/Transactions/ThreeAmountsV.swift b/TalerWallet1/Views/Transactions/ThreeAmountsV.swift @@ -70,7 +70,7 @@ struct ThreeAmountsV: View { @AppStorage("minimalistic") var minimalistic: Bool = false var body: some View { - let labelColor = Color(UIColor.label) + let labelColor = WalletColors().labelColor let foreColor = pending ? WalletColors().pendingColor(incoming) : WalletColors().transactionColor(incoming) Section { diff --git a/TalerWallet1/Views/Transactions/TransactionSummaryV.swift b/TalerWallet1/Views/Transactions/TransactionSummaryV.swift @@ -339,8 +339,8 @@ struct TransactionSummaryV: View { merchant: details.info?.merchant.name) } case .refresh(let refreshTransaction): Group { - let labelColor = Color(UIColor.label) - let errorColor = WalletColors().errorColor() + let labelColor = WalletColors().labelColor + let errorColor = WalletColors().errorColor let details = refreshTransaction.details Section { Text(details.refreshReason.localizedRefreshReason)