---
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.
