---
title: Gradient
framework: swiftui
role: symbol
role_heading: Structure
path: swiftui/gradient
---

# Gradient

A color gradient represented as an array of color stops, each having a parametric location value.

## Declaration

```swift
@frozen struct Gradient
```

## Mentioned in

Adding a background to your view

## Topics

### Creating a gradient from colors

- [init(colors:)](swiftui/gradient/init(colors:).md)

### Creating a gradient from stops

- [init(stops:)](swiftui/gradient/init(stops:).md)
- [stops](swiftui/gradient/stops.md)
- [Gradient.Stop](swiftui/gradient/stop.md)

### Working with color spaces

- [colorSpace(_:)](swiftui/gradient/colorspace(_:).md)
- [Gradient.ColorSpace](swiftui/gradient/colorspace.md)

## Relationships

### Conforms To

- [Copyable](swift/copyable.md)
- [Equatable](swift/equatable.md)
- [Escapable](swift/escapable.md)
- [Hashable](swift/hashable.md)
- [ScaleRange](charts/scalerange.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)
- [ShapeStyle](swiftui/shapestyle.md)

## See Also

### Styling content

- [border(_:width:)](swiftui/view/border(_:width:).md)
- [foregroundStyle(_:)](swiftui/view/foregroundstyle(_:).md)
- [foregroundStyle(_:_:)](swiftui/view/foregroundstyle(_:_:).md)
- [foregroundStyle(_:_:_:)](swiftui/view/foregroundstyle(_:_:_:).md)
- [backgroundStyle(_:)](swiftui/view/backgroundstyle(_:).md)
- [backgroundStyle](swiftui/environmentvalues/backgroundstyle.md)
- [ShapeStyle](swiftui/shapestyle.md)
- [AnyShapeStyle](swiftui/anyshapestyle.md)
- [MeshGradient](swiftui/meshgradient.md)
- [AnyGradient](swiftui/anygradient.md)
- [ShadowStyle](swiftui/shadowstyle.md)
- [Glass](swiftui/glass.md)
