FIX: colors were hard to read

This commit is contained in:
Marcos Rodriguez Vélez 2024-11-20 02:57:42 -04:00 committed by GitHub
parent 4143634bd0
commit 41f8a22a21
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2,6 +2,8 @@ import SwiftUI
@available(iOS 15.0, *)
struct CompactPriceView: View {
@Environment(\.colorScheme) var colorScheme
let price: String
let lastUpdated: String
let code: String
@ -12,14 +14,16 @@ struct CompactPriceView: View {
Text(price)
.font(.title)
.bold()
.foregroundColor(priceTextColor)
.shadow(color: Color.black.opacity(0.2), radius: 1, x: 0, y: 1)
.multilineTextAlignment(.center)
.dynamicTypeSize(.large ... .accessibility5)
.accessibilityLabel("Bitcoin price: \(price)")
VStack(alignment: .center, spacing: 8) {
Text("\(code)")
Text("\(lastUpdated)")
Text("\(dataSource)")
Text(code)
Text(lastUpdated)
Text(dataSource)
}
.font(.subheadline)
.foregroundColor(.secondary)
@ -29,4 +33,9 @@ struct CompactPriceView: View {
.padding()
.frame(maxWidth: .infinity)
}
// Adaptive color for the price text using system built-in colors
var priceTextColor: Color {
colorScheme == .dark ? .cyan : .blue
}
}