commit e5c3a9d5614f9f33e01d07f04ba2c3e559a9ca50
parent 85994f30809a5327cfd68e918872be764d4a777e
Author: Marc Stibane <marc@taler.net>
Date: Thu, 19 Dec 2024 20:36:07 +0100
A11Y colors + fontsize
Diffstat:
11 files changed, 48 insertions(+), 37 deletions(-)
diff --git a/TalerWallet1/Assets.xcassets/Error.colorset/Contents.json b/TalerWallet1/Assets.xcassets/Error.colorset/Contents.json
@@ -23,9 +23,9 @@
"color-space" : "display-p3",
"components" : {
"alpha" : "1.000",
- "blue" : "36",
- "green" : "52",
- "red" : "234"
+ "blue" : "99",
+ "green" : "99",
+ "red" : "255"
}
},
"idiom" : "universal"
diff --git a/TalerWallet1/Helper/Font+Taler.swift b/TalerWallet1/Helper/Font+Taler.swift
@@ -172,6 +172,7 @@ extension TalerFont { // old running
static var largeTitle: TalerFont { TalerFont(fontName, size: 34, relativeTo: .largeTitle) } // 34 -> 38
static var title: TalerFont { TalerFont(fontName, size: 28, relativeTo: .title) } // 28 -> 31
+ static var title1: TalerFont { TalerFont(fontName, size: 24, relativeTo: .title2) } // Destructive Buttons
static var title2: TalerFont { TalerFont(fontName, size: 22, relativeTo: .title2) } // 22 -> 25
static var title3: TalerFont { TalerFont(fontName, size: 20, relativeTo: .title3) } // 20 -> 23
static var picker: TalerFont { TalerFont(fontName, size: 18, relativeTo: .body) } // picker uses a different size!
@@ -179,6 +180,7 @@ extension TalerFont { // old running
static var body: TalerFont { TalerFont(fontName, size: 17, relativeTo: .body) } // 17 -> 19
static var callout: TalerFont { TalerFont(fontName, size: 16, relativeTo: .callout) } // 16 -> 18
static var subheadline: TalerFont { TalerFont(fontName, size: 15, relativeTo: .subheadline) } // 15 -> 17
+ static var table: TalerFont { TalerFont(fontName, size: 14, relativeTo: .subheadline) } // tableview uses a different size!
static var footnote: TalerFont { TalerFont(fontName, size: 13, relativeTo: .footnote) } // 13 -> 15
static var caption: TalerFont { TalerFont(fontName, size: 12, relativeTo: .caption) } // 12 -> 13
static var badge: TalerFont { TalerFont(fontName, size: 10, relativeTo: .caption) } // 12 -> 13
diff --git a/TalerWallet1/Helper/WalletColors.swift b/TalerWallet1/Helper/WalletColors.swift
@@ -9,7 +9,7 @@ fileprivate let grouped = true
public struct WalletColors {
@AppStorage("minimalistic") var minimalistic: Bool = false
- let tint = Color(.tintColor)
+// let tint = Color(.tintColor)
let gray1 = Color(.systemGray) // uncompleted
let gray2 = Color(.systemGray2) // disabled Fore
let gray3 = Color(.systemGray3)
@@ -21,26 +21,26 @@ public struct WalletColors {
let gray8 = grouped ? Color(.secondarySystemGroupedBackground)
: Color(.secondarySystemBackground) // disabled Back
- let attention = Color.red
- let confirm = Color.yellow
+ let attention = Color.red // TODO: WalletColors().errorColor
+ let confirm = Color.yellow // TODO: WalletColors().warningColor
// 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
- : disabled ? gray2
- : !prominent ? tint
- : pressed ? gray6 : gray5
+ func buttonForeColor(pressed: Bool,
+ disabled: Bool,
+ prominent: Bool = false) -> Color {
+ disabled ? gray2
+ : !prominent ? talerColor
+ : pressed ? gray6 : Color.white
}
- func buttonBackColor(pressed: Bool, disabled: Bool,
- prominent: Bool = false, balance: Bool = false) -> Color {
- balance ? (pressed ? gray5 : gray6)
- : disabled ? gray7
- : prominent ? tint
+ func buttonBackColor(pressed: Bool,
+ disabled: Bool,
+ prominent: Bool = false) -> Color {
+ disabled ? gray7
+ : prominent ? talerColor
: pressed ? gray4 : gray5
}
@@ -90,6 +90,10 @@ public struct WalletColors {
Color("Error")
}
+ var talerColor: Color {
+ Color("Taler")
+ }
+
func pendingColor(_ incoming: Bool) -> Color {
incoming ? Color("PendingIncoming")
: Color("PendingOutgoing")
@@ -99,5 +103,4 @@ public struct WalletColors {
incoming ? Color("Incoming")
: Color("Outgoing")
}
-
}
diff --git a/TalerWallet1/Views/Actions/ActionsSheet.swift b/TalerWallet1/Views/Actions/ActionsSheet.swift
@@ -65,7 +65,8 @@ struct ActionsSheet: View {
}
Button(action: shopAction) {
HStack {
- ButtonIconBadge(type: .payment, foreColor: .accentColor, done: false)
+ let talerColor = WalletColors().talerColor
+ ButtonIconBadge(type: .payment, foreColor: talerColor, done: false)
Spacer()
Text(title)
Spacer()
@@ -96,6 +97,9 @@ struct DualHeightSheet: View {
@Binding var qrButtonTapped: Bool
let logger = Logger(subsystem: "net.taler.gnu", category: "DualSheet")
+// let scanDetent: PresentationDetent = .fraction(SCANDETENT)
+ @Environment(\.colorScheme) private var colorScheme
+ @Environment(\.colorSchemeContrast) private var colorSchemeContrast
// @State private var sheetHeight: CGFloat = .zero
@State private var selectedDetent: PresentationDetent = .fraction(0.1)
@State private var detents: Set<PresentationDetent> = [.fraction(0.1)]
@@ -116,11 +120,13 @@ struct DualHeightSheet: View {
var body: some View {
ScrollView {
+ let background = colorScheme == .dark ? WalletColors().gray6
+ : WalletColors().gray2
ActionsSheet(stack: stack.push(),
qrButtonTapped: $qrButtonTapped2)
.presentationDragIndicator(.hidden)
.presentationBackground {
- WalletColors().gray2
+ background
/// overflow the bottom of the screen by a sufficient amount to fill the gap that is seen when the size changes
.padding(.bottom, -1000)
}
diff --git a/TalerWallet1/Views/Actions/TwoRowButtons.swift b/TalerWallet1/Views/Actions/TwoRowButtons.swift
@@ -34,7 +34,8 @@ struct TypeButton: View {
let blue = debug ? Color.blue : Color.clear
let orange = debug ? Color.orange : Color.clear
#endif
- let badge = ButtonIconBadge(type: type, foreColor: .accentColor, done: false)
+ let talerColor = WalletColors().talerColor
+ let badge = ButtonIconBadge(type: type, foreColor: talerColor, done: false)
let hLayout = HStack {
badge
Spacer()
diff --git a/TalerWallet1/Views/HelperViews/Buttons.swift b/TalerWallet1/Views/HelperViews/Buttons.swift
@@ -192,7 +192,6 @@ struct ReloadButton : View {
struct TalerButtonStyle: ButtonStyle {
enum TalerButtonStyleType {
case plain
- case balance
case bordered
case prominent
}
@@ -221,8 +220,7 @@ struct TalerButtonStyle: ButtonStyle {
}
return WalletColors().buttonForeColor(pressed: pressed,
disabled: disabled,
- prominent: type == .prominent,
- balance: type == .balance)
+ prominent: type == .prominent)
}
func backColor(type: TalerButtonStyleType, pressed: Bool, disabled: Bool) -> Color {
if type == .plain && !pressed {
@@ -230,8 +228,7 @@ struct TalerButtonStyle: ButtonStyle {
}
return WalletColors().buttonBackColor(pressed: pressed,
disabled: disabled,
- prominent: type == .prominent,
- balance: type == .balance)
+ prominent: type == .prominent)
}
struct BackgroundView: View {
@@ -297,7 +294,7 @@ fileprivate struct ContentView_Previews: PreviewProvider {
static var previews: some View {
let testButtonTitle = String("Placeholder")
Button(testButtonTitle) {}
- .buttonStyle(TalerButtonStyle(type: .balance, aligned: .trailing))
+ .buttonStyle(TalerButtonStyle(type: .bordered, aligned: .trailing))
}
}
#endif
diff --git a/TalerWallet1/Views/HelperViews/SubjectInputV.swift b/TalerWallet1/Views/HelperViews/SubjectInputV.swift
@@ -88,7 +88,7 @@ struct SubjectInputV<TargetView: View>: View {
//// Text(feeLabel)
// }
// .talerFont(.body)
-//// .foregroundColor(insufficient ? .red : WalletColors().secondary(colorScheme, colorSchemeContrast))
+// // .foregroundColor(insufficient ? WalletColors().errorColor : WalletColors().secondary(colorScheme, colorSchemeContrast))
// .foregroundColor(WalletColors().secondary(colorScheme, colorSchemeContrast))
//// .accessibility(sortPriority: 1)
// .padding(4)
diff --git a/TalerWallet1/Views/HelperViews/TabBarView.swift b/TalerWallet1/Views/HelperViews/TabBarView.swift
@@ -93,7 +93,7 @@ struct TabBarView: View {
}
}
}.id(tab)
- .foregroundColor(selection == tab ? .accentColor : .secondary)
+ .foregroundColor(selection == tab ? WalletColors().talerColor : .secondary)
.padding(.vertical, 8)
.accessibilityElement(children: .combine)
.accessibility(label: Text(tab.title))
diff --git a/TalerWallet1/Views/HelperViews/TransactionButton.swift b/TalerWallet1/Views/HelperViews/TransactionButton.swift
@@ -21,7 +21,7 @@ struct WarningButton: View {
@State private var showAlert: Bool = false
var body: some View {
- Button(role: role,
+ Button(//role: role,
action: {
if !disabled {
if shouldShowWarning && (role == .destructive || role == .cancel) {
@@ -31,15 +31,17 @@ struct WarningButton: View {
}
}
}) {
- HStack(spacing: 50) {
- Text(buttonTitle)
+ HStack(spacing: 20) {
if let buttonIcon {
Image(systemName: buttonIcon)
}
+ Text(buttonTitle)
}
.frame(maxWidth: .infinity)
+ .foregroundColor(role == .destructive ? WalletColors().errorColor
+ : WalletColors().talerColor)
}
- .talerFont(.title2)
+ .talerFont(.title1)
.buttonStyle(.bordered)
.controlSize(.large)
.disabled(disabled)
@@ -88,9 +90,9 @@ struct TransactionButton: View {
let buttonTitle = executed ? command.localizedActionExecuted
: command.localizedActionTitle
WarningButton(warningText: warning,
- buttonTitle: command.localizedActionTitle,
+ buttonTitle: buttonTitle,
buttonIcon: command.localizedActionImage,
- role: role,
+ role: role, // TODO: WalletColors().errorColor
disabled: $disabled,
action: doAction)
}
diff --git a/TalerWallet1/Views/Settings/Exchange/ExchangeSectionView.swift b/TalerWallet1/Views/Settings/Exchange/ExchangeSectionView.swift
@@ -143,7 +143,7 @@ struct ExchangeSectionView: View {
WarningButton(warningText: warningText1,
buttonTitle: buttonTitle,
buttonIcon: "trash",
- role: .destructive,
+ role: .destructive, // TODO: WalletColors().errorColor
disabled: $disabled,
action: deleteExchange)
.padding(.top)
diff --git a/TalerWallet1/Views/Settings/SettingsItem.swift b/TalerWallet1/Views/Settings/SettingsItem.swift
@@ -31,7 +31,7 @@ struct SettingsItem<Content: View>: View {
HStack {
VStack {
let isWeb = id1?.hasPrefix("web") ?? false
- let foreColor = isWeb ? WalletColors().tint
+ let foreColor = isWeb ? WalletColors().talerColor
: .primary
HStack(spacing: 8.0) {
if let imageName {