swiftswiftuidatepickerapple-watchwatch

Change label Color on Date Picker Swift UI


enter image description here

So I want to change my Date picker (WheelDatePickerStyle) label color, currently default is green i want to change to yellow already tried several properties like accentColor but didnt work. Thanks

Heres my code:

DatePicker(
    "Start Date",
    selection: $date,
    in: dateRange,
    displayedComponents: [.date]
).datePickerStyle(WheelDatePickerStyle())

Solution

  • I don´t think there is a specific API for styling the highlight color. But you can try to use hueRotation.

    struct ContentView: View {
        @State private var date = Date.now
        var body: some View {
            DatePicker("", selection: $date, displayedComponents: .hourMinuteAndSecond)
                .hueRotation(Angle(degrees: 270))            
        }
    }
    

    Output:

    example