Merge pull request #7420 from BlueWallet/read

FIX: Readable colors on PriceView
This commit is contained in:
GLaDOS 2024-12-23 10:36:00 +00:00 committed by GitHub
commit cc8bedadb3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -16,6 +16,7 @@ struct CompactPriceView: View {
.bold()
.multilineTextAlignment(.center)
.dynamicTypeSize(.large ... .accessibility5)
.foregroundColor(textColor())
.accessibilityLabel("Bitcoin price: \(price)")
VStack(alignment: .center, spacing: 8) {
@ -27,7 +28,7 @@ struct CompactPriceView: View {
.shadow(color: shadowColor(), radius: 1, x: 0, y: 1)
}
.font(.subheadline)
.foregroundColor(.secondary)
.foregroundColor(textColor())
.multilineTextAlignment(.center)
.accessibilityElement(children: .combine)
}
@ -35,8 +36,12 @@ struct CompactPriceView: View {
.frame(maxWidth: .infinity)
}
private func textColor() -> Color {
colorScheme == .dark ? .white : .black
}
private func shadowColor() -> Color {
colorScheme == .dark ? .white.opacity(0.2) : .black.opacity(0.2)
textColor().opacity(0.2)
}
}
@ -45,7 +50,6 @@ struct CompactPriceView: View {
struct CompactPriceView_Previews: PreviewProvider {
static var previews: some View {
ZStack {
// Example vibrant background
LinearGradient(
gradient: Gradient(colors: [.blue, .purple]),
startPoint: .top,