commit 22086bdb89cd5d515e4c478161d19ed5f3bcd8bc parent fa29368d2269e1b94ca1a023d28dbaccebc6317f Author: Marc Stibane <marc@taler.net> Date: Sat, 12 Sep 2026 09:06:07 +0200 Colors Diffstat:
11 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/TalerCommon/Helper/WalletColors.swift b/TalerCommon/Helper/WalletColors.swift @@ -84,12 +84,12 @@ public struct WalletColors { : pressed ? gray4 : gray5 } - func primary(_ contrast: ColorSchemeContrast = .standard) -> Color { - return contrast == .increased ? .primary - : Color("Primary") + func primary2(_ scheme: ColorScheme, _ contrast: ColorSchemeContrast = .standard) -> Color { + return contrast == .increased ? (scheme == .dark ? Color.white : Color.black) + : .primary } - func secondary(_ scheme: ColorScheme, _ contrast: ColorSchemeContrast = .standard) -> Color { + func secondary2(_ scheme: ColorScheme, _ contrast: ColorSchemeContrast = .standard) -> Color { return contrast == .increased ? .primary // WCAG AAA for any scheme : minimalistic ? .secondary // not enough contrast : scheme == .dark ? .secondary // WCAG AA for dark scheme diff --git a/TalerWallet1/Views/Actions/Banking/DepositAmountView.swift b/TalerWallet1/Views/Actions/Banking/DepositAmountView.swift @@ -129,7 +129,7 @@ struct DepositAmountView: View { : feeLabel(feeStr)) .talerFont(.body) .foregroundColor(insufficient ? WalletColors().attention - : (feeAmount?.isZero ?? true) ? WalletColors().secondary(colorScheme, colorSchemeContrast) + : (feeAmount?.isZero ?? true) ? WalletColors().secondary2(colorScheme, colorSchemeContrast) : WalletColors().negative) .padding(4) let hint = String(localized: "enabled when amount is non-zero, but not higher than your available amount", diff --git a/TalerWallet1/Views/Actions/Peer2peer/P2PSubjectV.swift b/TalerWallet1/Views/Actions/Peer2peer/P2PSubjectV.swift @@ -114,7 +114,7 @@ struct P2PSubjectV: View { Text(label.0) .accessibilityLabel(label.1) .frame(maxWidth: .infinity, alignment: .trailing) - .foregroundColor(WalletColors().secondary(colorScheme, colorSchemeContrast)) + .foregroundColor(WalletColors().secondary2(colorScheme, colorSchemeContrast)) .talerFont(.body) } } diff --git a/TalerWallet1/Views/Balances/BalanceCellV.swift b/TalerWallet1/Views/Balances/BalanceCellV.swift @@ -68,7 +68,7 @@ struct BalanceCellV: View { } else { let balanceText = Text("Balance:", comment: "Main view") .talerFont(.title2) - .foregroundColor(WalletColors().secondary(colorScheme, colorSchemeContrast)) + .foregroundColor(WalletColors().secondary2(colorScheme, colorSchemeContrast)) let vLayout = VStack(alignment: .leading, spacing: 0) { balanceText hLayout diff --git a/TalerWallet1/Views/Balances/DiscountPasses.swift b/TalerWallet1/Views/Balances/DiscountPasses.swift @@ -54,16 +54,16 @@ struct DiscountsPassesItem: View { var body: some View { let isValid = token.validityStart < .now() let isExpired = token.validityEnd < .now() - let primary = WalletColors().primary(colorSchemeContrast) - let secondary = WalletColors().secondary(colorScheme, colorSchemeContrast) + let primary2 = WalletColors().primary2(colorScheme, colorSchemeContrast) + let secondary = WalletColors().secondary2(colorScheme, colorSchemeContrast) let primaryAccent = WalletColors().primaryAccent let name = Text(token.name) .talerFont(.title) - .foregroundColor(primary) + .foregroundColor(primary2) let desc = Text(token.description) .talerFont(.body) - .foregroundColor(primary) + .foregroundColor(primary2) Section { let swipe = Button { @@ -235,7 +235,7 @@ struct DiscountPassesSection: View { let discText = String(localized: "Discounts") let passText = String(localized: "Passes") let activeColor = WalletColors().primaryAccent - let inactiveColor = WalletColors().secondary(colorScheme, colorSchemeContrast) + let inactiveColor = WalletColors().secondary2(colorScheme, colorSchemeContrast) let discCount = controller.discounts.count let passCount = controller.subscriptions.count if discCount > 0 || passCount > 0 { diff --git a/TalerWallet1/Views/HelperViews/BarGraph.swift b/TalerWallet1/Views/HelperViews/BarGraph.swift @@ -45,7 +45,7 @@ struct BarGraphHeader: View { Text(currencyInfo.name) .strikethrough(isLegacy, color: WalletColors().attention) .talerFont(.title2) - .foregroundColor(WalletColors().secondary(colorScheme, colorSchemeContrast)) + .foregroundColor(WalletColors().secondary2(colorScheme, colorSchemeContrast)) } BarGraph(transactions: $completedTransactions, maxBars: MAXBARS, barHeight: barHeight) diff --git a/TalerWallet1/Views/Main/WalletEmptyView.swift b/TalerWallet1/Views/Main/WalletEmptyView.swift @@ -109,7 +109,7 @@ struct ProdSectionView: View { .talerFont(.badge) // .foregroundColor(.primary) /// YIKES! when not specifying this color, the Text in the BarGraphHeader vanishes!!! - .foregroundColor(WalletColors().secondary(colorScheme, colorSchemeContrast)) + .foregroundColor(WalletColors().secondary2(colorScheme, colorSchemeContrast)) // .listRowInsets(EdgeInsets()) // << here !! } } diff --git a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift @@ -204,11 +204,11 @@ struct ExpiresView: View { Text("Expires: \(dateString)") .talerFont(.body) .accessibilityLabel(a11yLabel) - .foregroundColor(WalletColors().secondary(colorScheme, colorSchemeContrast)) + .foregroundColor(WalletColors().secondary2(colorScheme, colorSchemeContrast)) } else { // should never happen Text("Unknown Expiration") .talerFont(.body) - .foregroundColor(WalletColors().secondary(colorScheme, colorSchemeContrast)) + .foregroundColor(WalletColors().secondary2(colorScheme, colorSchemeContrast)) } } } diff --git a/TalerWallet1/Views/Transactions/ThreeAmountsSection.swift b/TalerWallet1/Views/Transactions/ThreeAmountsSection.swift @@ -238,7 +238,7 @@ struct ThreeAmountsSection: View { if let header { Text(header) .talerFont(.title3) - .foregroundColor(WalletColors().secondary(colorScheme, colorSchemeContrast)) + .foregroundColor(WalletColors().secondary2(colorScheme, colorSchemeContrast)) } } .task { await viewDidLoad() } diff --git a/TalerWallet1/Views/Transactions/TransactionSummaryList.swift b/TalerWallet1/Views/Transactions/TransactionSummaryList.swift @@ -184,7 +184,7 @@ struct TransactionSummaryList: View { Text(dateString) .talerFont(.body) .accessibilityLabel(a11yDate) - .foregroundColor(WalletColors().secondary(colorScheme, colorSchemeContrast)) + .foregroundColor(WalletColors().secondary2(colorScheme, colorSchemeContrast)) .id(topID) let state = localizedState(common.txState) let statusT = Text(state) diff --git a/TalerWallet1/Views/Transactions/TransactionsListView.swift b/TalerWallet1/Views/Transactions/TransactionsListView.swift @@ -176,7 +176,7 @@ struct TransactionsArraySection: View { func headerView(_ header: String) -> some View { Text(header) .talerFont(.title3) - .foregroundColor(WalletColors().secondary(colorScheme, colorSchemeContrast)) + .foregroundColor(WalletColors().secondary2(colorScheme, colorSchemeContrast)) } var body: some View {