Reputation: 1887
I have two datepickers, but the font color is white even I set it to be black. Makes them hard to read.
DatePicker(selection: $fromDate.onChange(self.setFromDate(fromdate:)), in: ...Date(), displayedComponents: .date) {
Text("From")
.font(.body)
.foregroundColor(.black)
.fixedSize()
}
DatePicker(selection: $toDate.onChange(self.setToDate(todate:)), in: ...Date(), displayedComponents: .date) {
Text("To")
.foregroundColor(.black)
.font(.body)
.fixedSize()
}
Upvotes: 0
Views: 176
Reputation: 19014
You can use .accentColor()
DatePicker(selection: $fromDate.onChange(self.setFromDate(fromdate:)), in: ...Date(), displayedComponents: .date) {
Text("From")
.font(.body)
.foregroundColor(.black)
.fixedSize()
}
.accentColor(Color.black)
Upvotes: 2