Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slider with Gradient only from Red to Green color #63

Open
shoaiblucideus opened this issue Mar 8, 2017 · 4 comments
Open

Slider with Gradient only from Red to Green color #63

shoaiblucideus opened this issue Mar 8, 2017 · 4 comments

Comments

@shoaiblucideus
Copy link

shoaiblucideus commented Mar 8, 2017

Hi Soundar,

I want to achieve a effect in which path will be gradient from red to green color... Something like colorPicker example but all with all colors. Color Range only be Red to Green ( i.e Red, Orange, Yellow, Green).

Any Help

@soundar24
Copy link
Owner

Here I made a color picker based on your requirement, check the below demo and update me your comments:

https://jsfiddle.net/soundar24/qekqkp3n/1/

If you need any alternate design or functionality then let me know some brief details, also you can share any rough screenshot for your requirement.

@SterlingButters
Copy link

SterlingButters commented Apr 10, 2020

@soundar24 Is there a simpler solution? Something like:

$("#slider").roundSlider({
    sliderType: "range",
    ...
    
    svgMode: true,
    pathColor: "linear-gradient(to right, blue 0%, red 100%)",
    rangeColor: "linear-gradient(to right, blue 0%, red 100%)",    
});

or

#slider .rs-range-color { background: linear-gradient(to right, blue 0%, red 100%); }

and/or

#slider .rs-path-color { background: linear-gradient(to right, blue 0%, red 100%); }

I tried your example but couldn't necessary adapt it

Awesome project btw

@soundar24
Copy link
Owner

@SterlingButters recently I have updated a similar answer in StackOverflow, based on that you can simply use the Conic CSS gradient for this. Check the below demos:
https://jsfiddle.net/soundar24/6se2tmp9/3/
https://jsfiddle.net/soundar24/6se2tmp9/4/

Suppose if you want to use the range slider, then just go with the below way:
https://jsfiddle.net/soundar24/6se2tmp9/5/

Still if you need any more customization then let me know some more details with the actual use-case which is better to understand and provide my suggestions.. thanks

@SterlingButters
Copy link

@soundar24 perfect, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants