Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SVG linear gradient from hue 0 to 360

Tags:

svg

graphics

SVG linear gradient
(source: elv1s.ru)

What a proper way to do a gradient like this? I tried this SVG:

<linearGradient id="hue" x1="0" y1="1" x2="0" y2="0">
    <stop offset="0%" stop-color="#ff0000"/>
    <stop offset="17%" stop-color="#ffff00"/>
    <stop offset="34%" stop-color="#00ff00"/>
    <stop offset="50%" stop-color="#00ffff"/>
    <stop offset="66%" stop-color="#0000ff"/>
    <stop offset="82%" stop-color="#ff00ff"/>
    <stop offset="100%" stop-color="#ff0000"/>
</linearGradient>

It works, but still not good enough:

SVG linear gradient
(source: elv1s.ru)

I can see the difference between those two gradients. Is there a better way of doing it?

like image 470
NVI Avatar asked Aug 07 '10 09:08

NVI


1 Answers

Have you tried using better precision in your %? As Josh is showing, you can have sub-percent precision and space your stops better.

like image 144
Russell Leggett Avatar answered Oct 11 '22 13:10

Russell Leggett