spacenation / swiftui-sliders

:rocket: SwiftUI Sliders with custom styles
MIT License
793 stars 84 forks source link

Track colors #51

Closed gemiren closed 2 years ago

gemiren commented 2 years ago

First of all, thanks for the awesome library. Would love to see more examples of usage. I'm trying to set different track colors for active (left of thumb) and inactive (right of the thumb) parts. How can I do that? Any help is appreciated.

ay42 commented 2 years ago

@gemiren

ValueSlider(value: $value5)
    .valueSliderStyle(
        HorizontalValueSliderStyle(
            track:
                HorizontalTrack(view: Color.blue)
                    .frame(height: 3)
                    .background(Color.red)
                    .cornerRadius(1.5)
        )
    )
Screen Shot 2022-04-17 at 9 14 26 AM

I also added your example to the project here 538e16b35ad7a066a8f5624da9ecee6327886bf7

gemiren commented 2 years ago

Perfect! Thanks very much for the example.