<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreImage",
  "identifier" : "/documentation/CoreImage/CIColor/init(red:green:blue:colorSpace:)-2og6y",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Core Image"
    ],
    "preciseIdentifier" : "c:objc(cs)CIColor(cm)colorWithRed:green:blue:colorSpace:"
  },
  "title" : "init(red:green:blue:colorSpace:)"
}
-->

# 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.

```
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


An autoreleased [`CIColor`](/documentation/CoreImage/CIColor) instance.

## 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.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)