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

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

Initialize 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 initialized 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.
