---
title: "setShadow(offset:blur:color:)"
framework: coregraphics
role: symbol
role_heading: Instance Method
path: "coregraphics/cgcontext/setshadow(offset:blur:color:)"
---

# setShadow(offset:blur:color:)

Enables shadowing with color a graphics context.

## Declaration

```swift
func setShadow(offset: CGSize, blur: CGFloat, color: CGColor?)
```

## Parameters

- `offset`: Specifies a translation in base-space.
- `blur`: A non-negative number specifying the amount of blur.
- `color`: Specifies the color of the shadow, which may contain a non-opaque alpha value. If NULL, then shadowing is disabled.

## See Also

### Setting Fill, Stroke, and Shadow Colors

- [setFillColor(_:)](coregraphics/cgcontext/setfillcolor(_:)-8lhn8.md)
- [setFillColor(_:)](coregraphics/cgcontext/setfillcolor(_:)-756dy.md)
- [setFillColor(cyan:magenta:yellow:black:alpha:)](coregraphics/cgcontext/setfillcolor(cyan:magenta:yellow:black:alpha:).md)
- [setFillColor(gray:alpha:)](coregraphics/cgcontext/setfillcolor(gray:alpha:).md)
- [setFillColor(red:green:blue:alpha:)](coregraphics/cgcontext/setfillcolor(red:green:blue:alpha:).md)
- [setFillColorSpace(_:)](coregraphics/cgcontext/setfillcolorspace(_:).md)
- [setShadow(offset:blur:)](coregraphics/cgcontext/setshadow(offset:blur:).md)
- [setStrokeColor(_:)](coregraphics/cgcontext/setstrokecolor(_:)-1sskg.md)
- [setStrokeColor(_:)](coregraphics/cgcontext/setstrokecolor(_:)-4pd8p.md)
- [setStrokeColor(cyan:magenta:yellow:black:alpha:)](coregraphics/cgcontext/setstrokecolor(cyan:magenta:yellow:black:alpha:).md)
- [setStrokeColor(gray:alpha:)](coregraphics/cgcontext/setstrokecolor(gray:alpha:).md)
- [setStrokeColor(red:green:blue:alpha:)](coregraphics/cgcontext/setstrokecolor(red:green:blue:alpha:).md)
- [setStrokeColorSpace(_:)](coregraphics/cgcontext/setstrokecolorspace(_:).md)
- [setStrokePattern(_:colorComponents:)](coregraphics/cgcontext/setstrokepattern(_:colorcomponents:).md)
- [setAlpha(_:)](coregraphics/cgcontext/setalpha(_:).md)
