mirror of
https://github.com/svg/svgo.git
synced 2026-01-27 07:02:06 +03:00
12 lines
859 B
Plaintext
12 lines
859 B
Plaintext
---
|
|
title: convertOneStopGradients
|
|
svgo:
|
|
pluginId: convertOneStopGradients
|
|
---
|
|
|
|
Converts the [`<linearGradient>`](https://developer.mozilla.org/docs/Web/SVG/Element/linearGradient) and [`<radialGradient>`](https://developer.mozilla.org/docs/Web/SVG/Element/radialGradient) nodes that are effectively a solid color to the color.
|
|
|
|
These nodes contain [`<stop>`](https://developer.mozilla.org/docs/Web/SVG/Element/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>`](https://developer.mozilla.org/docs/Web/SVG/Element/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.
|