Back to Svgo

convertOneStopGradients

docs/04-plugins/convertOneStopGradients.mdx

4.0.1800 B
Original Source

Converts the <linearGradient> and <radialGradient> nodes that are effectively a solid color to the color.

These nodes contain <stop> elements, which represent various colors to transition between. However, if a gradient only contains a single <stop>, then it's effectively a solid fill.

Definitions of the gradients are removed, and the parent <defs> node is removed if it has no children after optimization. The xlink:href namespace is also removed if there are no remaining elements using this attribute.