# BackgroundGradient

> Color gradient that can be used as a Background, mirroring the CSS linear-gradient() / radial-gradient() functions.

## Definition

* **Type:** Struct
* **Namespace:** [UnityEngine.UIElements](/engine/6000.7/script-reference/unityengine/uielements.md)
* **Assembly:** UnityEngine.UIElementsModule
* **Implements:** [IEquatable\<BackgroundGradient>](https://learn.microsoft.com/dotnet/api/system.iequatable-1)

```csharp
public struct BackgroundGradient : IEquatable<BackgroundGradient>
```

## Remarks

A default-constructed [BackgroundGradient](/engine/6000.7/script-reference/unityengine/uielements/backgroundgradient.md) has no color stops and is treated as "no gradient" — see [BackgroundGradient.IsEmpty](/engine/6000.7/script-reference/unityengine/uielements/backgroundgradient/isempty.md).

## Properties

| Property                                                                                          | Description                                                                                                                                                                                                     |
| ------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [angle](/engine/6000.7/script-reference/unityengine/uielements/backgroundgradient/angle.md)       | Angle of a linear gradient, in radians, measured clockwise from "to top" (CSS convention, matching `linear-gradient(0deg, ...)`). Ignored for radial gradients.                                                 |
| [position](/engine/6000.7/script-reference/unityengine/uielements/backgroundgradient/position.md) | Center of a radial gradient, expressed as a fraction in \[0,1] of the element box (0 = top-left, 1 = bottom-right). Default (0.5, 0.5) places the gradient at the element center. Ignored for linear gradients. |
| [shape](/engine/6000.7/script-reference/unityengine/uielements/backgroundgradient/shape.md)       | Shape used to interpret \_size for radial gradients. Ignored for linear gradients.                                                                                                                              |
| [size](/engine/6000.7/script-reference/unityengine/uielements/backgroundgradient/size.md)         | Extent of a radial gradient. Ignored for linear gradients.                                                                                                                                                      |
| [stops](/engine/6000.7/script-reference/unityengine/uielements/backgroundgradient/stops.md)       | Ordered list of color stops along the gradient axis.                                                                                                                                                            |
| [type](/engine/6000.7/script-reference/unityengine/uielements/backgroundgradient/type.md)         | Whether the gradient transitions linearly or radiates from a center point.                                                                                                                                      |

## Methods

| Method                                                                                          | Description                                                                      |
| ----------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
| [IsEmpty](/engine/6000.7/script-reference/unityengine/uielements/backgroundgradient/isempty.md) | True when this gradient has no color stops, meaning it represents "no gradient". |

## Static Methods

| Method                                                                                        | Description                                                                    |
| --------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ |
| [Linear](/engine/6000.7/script-reference/unityengine/uielements/backgroundgradient/linear.md) | Construct a linear gradient from an angle (radians) and a stop list.           |
| [Radial](/engine/6000.7/script-reference/unityengine/uielements/backgroundgradient/radial.md) | Construct a radial gradient at the element center with default extent / shape. |
