Akbar Basha
Akbar Basha

Reputation: 1198

How to create gradient color in svg background

I need to create the background color in given svg circle as like an below image.. how to acheive this background color using gradient?

Note: just background color for that pic no need for needle, tick and label.

enter image description here

Sample Link: http://jsfiddle.net/mkn9t627/4/

<svg height="500" width="500">
  <circle cx="150" cy="150" r="100" stroke="black" stroke-width="3" fill="transparent" /> 
</svg> 

Upvotes: 0

Views: 1680

Answers (1)

Deepthi S
Deepthi S

Reputation: 273

Fiddle: https://jsfiddle.net/oLsLdqas/1/

<svg height="250" width="500">
  <defs>
    <radialGradient id="grad1" cx="50%" cy="50%" r="50%" fx="60%" fy="20%">
      <stop offset="0%" style="stop-color:rgb(0,0,0);stop-opacity:0" />
      <stop offset="100%" style="stop-color:rgb(1,1,1);stop-opacity:1" />
    </radialGradient>
  </defs>
  <circle cx="180" cy="100" r="100"  fill="url(#grad1)" />

</svg>

Refer link for more information : https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Gradients

Upvotes: 2

Related Questions