---
title: "setStrokeColorSpace(_:)"
framework: coregraphics
role: symbol
role_heading: Instance Method
path: "coregraphics/cgcontext/setstrokecolorspace(_:)"
---

# setStrokeColorSpace(_:)

Sets the stroke color space in a graphics context.

## Declaration

```swift
func setStrokeColorSpace(_ space: CGColorSpace)
```

## Parameters

- `space`: The new stroke color space. The color space is retained; upon return, you may safely release it.

## Discussion

Discussion As a side effect when you call this function, Core Graphics assigns an appropriate initial value to the stroke color, based on the color space you specify. To change this value, call setStrokeColor(_:). Note that the preferred API is now setStrokeColor(_:).

## 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)
- [setShadow(offset:blur:color:)](coregraphics/cgcontext/setshadow(offset:blur:color:).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)
- [setStrokePattern(_:colorComponents:)](coregraphics/cgcontext/setstrokepattern(_:colorcomponents:).md)
- [setAlpha(_:)](coregraphics/cgcontext/setalpha(_:).md)
