Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change font color in new DatePicker (iOS14)

How can i change foreground color in new DatePicker for iOS 14?

VStack (alignment: .center, spacing: 0)
{
    DatePicker(selection: self.$enddate, in: self.endMinDate()...self.endMaxDate()) {
        Text("Start")
    }.labelsHidden().colorMultiply(MyColor.bluecolor)
}.foregroundColor(MyColor.bluecolor)

enter image description here

Old DatePicker in iOS 13 without problem:

enter image description here

like image 414
alexbayker Avatar asked Oct 20 '25 04:10

alexbayker


1 Answers

I don't have your colors but the following should work.

Tested with Xcode 12.1 / iOS 14.1

demo

VStack (alignment: .center, spacing: 0)
{
    DatePicker(selection: self.$enddate, in: self.endMinDate()...self.endMaxDate()) {
        Text("Start")
    }.labelsHidden()
}
.accentColor(MyColor.bluecolor)  // << this one !!
//.accentColor(.red)             // << used for demo
like image 120
Asperi Avatar answered Oct 22 '25 03:10

Asperi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!