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

# setFillColorSpace(_:)

Sets the fill color space in a graphics context.

## Declaration

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

## Parameters

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

## Discussion

Discussion As a side effect of this function, Core Graphics assigns an appropriate initial value to the fill color, based on the specified color space. To change this value, call setFillColor(_:). Note that the preferred API to use is now setFillColor(_:).

## 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)
- [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)
- [setStrokeColorSpace(_:)](coregraphics/cgcontext/setstrokecolorspace(_:).md)
- [setStrokePattern(_:colorComponents:)](coregraphics/cgcontext/setstrokepattern(_:colorcomponents:).md)
- [setAlpha(_:)](coregraphics/cgcontext/setalpha(_:).md)
