---
title: GraphicsContext.Shading
framework: swiftui
role: symbol
role_heading: Structure
path: swiftui/graphicscontext/shading
---

# GraphicsContext.Shading

A color or pattern that you can use to outline or fill a path.

## Declaration

```swift
struct Shading
```

## Overview

Overview Use a shading instance to describe the color or pattern of a path that you outline with a method like stroke(_:with:style:), or of the interior of a region that you fill with the fill(_:with:style:) method. Get a shading instance by calling one of the Shading structure’s factory methods. You can base shading on: A Color. A Gradient. Any type that conforms to ShapeStyle. An Image. What you’ve already drawn into the context. A collection of other shading instances.

## Topics

### Colors

- [color(_:)](swiftui/graphicscontext/shading/color(_:).md)
- [color(_:red:green:blue:opacity:)](swiftui/graphicscontext/shading/color(_:red:green:blue:opacity:).md)
- [color(_:white:opacity:)](swiftui/graphicscontext/shading/color(_:white:opacity:).md)

### Gradients

- [linearGradient(_:startPoint:endPoint:options:)](swiftui/graphicscontext/shading/lineargradient(_:startpoint:endpoint:options:).md)
- [radialGradient(_:center:startRadius:endRadius:options:)](swiftui/graphicscontext/shading/radialgradient(_:center:startradius:endradius:options:).md)
- [conicGradient(_:center:angle:options:)](swiftui/graphicscontext/shading/conicgradient(_:center:angle:options:).md)

### Other shape styles

- [style(_:)](swiftui/graphicscontext/shading/style(_:).md)
- [foreground](swiftui/graphicscontext/shading/foreground.md)

### Images

- [tiledImage(_:origin:sourceRect:scale:)](swiftui/graphicscontext/shading/tiledimage(_:origin:sourcerect:scale:).md)

### Composite shading types

- [palette(_:)](swiftui/graphicscontext/shading/palette(_:).md)
- [backdrop](swiftui/graphicscontext/shading/backdrop.md)

### Using a custom Metal shader

- [shader(_:bounds:)](swiftui/graphicscontext/shading/shader(_:bounds:).md)

### Type Methods

- [meshGradient(_:)](swiftui/graphicscontext/shading/meshgradient(_:).md)
- [radialGradient(_:startCenter:startRadius:endCenter:endRadius:options:)](swiftui/graphicscontext/shading/radialgradient(_:startcenter:startradius:endcenter:endradius:options:).md)

## Relationships

### Conforms To

- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Drawing a path

- [stroke(_:with:lineWidth:)](swiftui/graphicscontext/stroke(_:with:linewidth:).md)
- [stroke(_:with:style:)](swiftui/graphicscontext/stroke(_:with:style:).md)
- [fill(_:with:style:)](swiftui/graphicscontext/fill(_:with:style:).md)
- [GraphicsContext.GradientOptions](swiftui/graphicscontext/gradientoptions.md)
