---
title: "init(red:green:blue:colorSpace:)"
framework: coreimage
role: symbol
role_heading: Initializer
path: "coreimage/cicolor/init(red:green:blue:colorspace:)-2og6y"
---

# init(red:green:blue:colorSpace:)

Create a Core Image color object with the specified red, green, and blue component values as measured in the specified color space.

## Declaration

```swift
convenience init?(red: CGFloat, green: CGFloat, blue: CGFloat, colorSpace: CGColorSpace)
```

## Parameters

- `red`: The color’s unpremultiplied red component value.
- `green`: The color’s unpremultiplied green component value.
- `blue`: The color’s unpremultiplied blue component value.
- `colorSpace`: The color’s CGColorSpace which must have kCGColorSpaceModelRGB.

## Return Value

Return Value  An autoreleased CIColor instance.

## Discussion

Discussion This will return null if the CGColorSpace is not kCGColorSpaceModelRGB. The RGB values can be outside the 0...1 range if the CGColorSpace is unclamped.

## See Also

### Creating Color Objects

- [init(red:green:blue:)](coreimage/cicolor/init(red:green:blue:).md)
- [init(string:)](coreimage/cicolor/init(string:).md)
- [init(red:green:blue:alpha:colorSpace:)](coreimage/cicolor/init(red:green:blue:alpha:colorspace:)-5mvff.md)
