<!--
{
  "availability" : [
    "iOS: 5.0.0 -",
    "iPadOS: 5.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.4.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreImage",
  "identifier" : "/documentation/CoreImage/CIColor/init(string:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Core Image"
    ],
    "preciseIdentifier" : "c:objc(cs)CIColor(cm)colorWithString:"
  },
  "title" : "init(string:)"
}
-->

# init(string:)

Create a Core Image color object in the sRGB color space using a string containing the RGBA color component values.

```
convenience init(string representation: String)
```

## Parameters

`representation`

A string that contains color and alpha float values.
For example, the string: `"0.5 0.7 0.3 1.0"` indicates an RGB color whose components
are 50% red, 70% green, 30% blue, and 100% opaque.
If the string contains only 3 float values, the alpha component will be `1.0`
If the string contains no float values, then `/CIColor/clearColor` will be returned.

## Return Value


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

## Discussion

On macOS before 10.10, the CIColor’s color space will be Generic RGB.

---

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)