---
title: "init(string:)"
framework: coreimage
role: symbol
role_heading: Initializer
path: "coreimage/cicolor/init(string:)"
---

# init(string:)

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

## Declaration

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

Return Value  An autoreleased CIColor instance.

## Discussion

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

## See Also

### Creating Color Objects

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