Usage
$ npm install gradient2svg
Convert linear-gradient()
and radial-gradient()
import cssGradient2SVG from 'gradient2svg'
const svgGradient1 = cssGradient2SVG('linear-gradient(55deg, #f00, #000)');
const svgGradient2 = cssGradient2SVG('radial-gradient(circle at 10% center, #f00 10%, #00f 95%)');
Imporrtant
Currently, the <size>
keywords such as closest-side
, closest-corner
, farthest-side
, farthest-corner
, cover
and contain
that are describing a responsive size of a radial-gradient
in CSS are NOT supported because there is no way to describe this in plain SVG.