---
title: CIColor
framework: coreimage
role: symbol
role_heading: Class
path: coreimage/cicolor
---

# CIColor

The Core Image class that defines a color object.

## Declaration

```swift
class CIColor
```

## Mentioned in

Selectively Focusing on an Image

## Overview

Overview Use CIColor instances in conjunction with other Core Image classes, such as CIFilter and CIKernel. Many of the built-in Core Image filters have one or more CIColor inputs that you can set to affect the filter’s behavior. Color Model A color is defined as a N-dimensional model where each dimension’s color component is represented by intensity values. A color component may also be referred to as a color channel. An RGB color model, for example, is three-dimensional and the red, green, and blue component intensities define each unique color. Color Space A color is also defined by a color space that locates the axes of N-dimensional model within the greater volume of human perceivable colors.  Core Image uses CGColorSpace instances to specify a variety of different color spaces such as sRGB, P3, BT.2020, etc. The CGColorSpace also defines if the color space is coded linearly or in a non-linear perceptual curve. (For more information on CGColorSpace see CGColorSpace) Color Range Standard dynamic range (SDR) color color component values range from 0.0 to 1.0, with 0.0 representing an 0% of that component and 1.0 representing 100%. In contrast, high dynamic range (HDR) color values can be less than 0.0 (for more saturation) or greater than 1.0 (for more brightness). Color Opacity CIColor instances also have an alpha component, which represents the opacity of the color, with 0.0 meaning completely transparent and 1.0 meaning completely opaque. If a color does not have an explicit alpha component, Core Image assumes that the alpha component equals 1.0. With CIColor that color components values are not premultiplied. So for example, a semi-transparent pure red CIColor is represented by RGB 1.0,0.0,0.0 and A 0.5.  In contrast color components values in CIImage buffers or read in CIKernel samplers are premultiplied by default.

## Topics

### Initializing Color Objects

- [init(cgColor:)](coreimage/cicolor/init(cgcolor:)-1hzk4.md)
- [init(color:)](coreimage/cicolor/init(color:).md)
- [init(red:green:blue:alpha:)](coreimage/cicolor/init(red:green:blue:alpha:).md)

### 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: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)

### Getting Color Components

- [colorSpace](coreimage/cicolor/colorspace.md)
- [components](coreimage/cicolor/components.md)
- [numberOfComponents](coreimage/cicolor/numberofcomponents.md)
- [red](coreimage/cicolor/red-swift.property.md)
- [green](coreimage/cicolor/green-swift.property.md)
- [blue](coreimage/cicolor/blue-swift.property.md)
- [alpha](coreimage/cicolor/alpha.md)
- [stringRepresentation](coreimage/cicolor/stringrepresentation.md)

### Creating a CIColor Object with Preset Components

- [black](coreimage/cicolor/black.md)
- [blue](coreimage/cicolor/blue-swift.type.property.md)
- [clear](coreimage/cicolor/clear.md)
- [cyan](coreimage/cicolor/cyan.md)
- [gray](coreimage/cicolor/gray.md)
- [green](coreimage/cicolor/green-swift.type.property.md)
- [magenta](coreimage/cicolor/magenta.md)
- [red](coreimage/cicolor/red-swift.type.property.md)
- [white](coreimage/cicolor/white.md)
- [yellow](coreimage/cicolor/yellow.md)

### Initializers

- [init(CGColor:)](coreimage/cicolor/init(cgcolor:)-2n26w.md)
- [init(CGColor:)](coreimage/cicolor/init(cgcolor:)-2nx98.md)
- [init(coder:)](coreimage/cicolor/init(coder:).md)
- [init(red:green:blue:alpha:colorSpace:)](coreimage/cicolor/init(red:green:blue:alpha:colorspace:)-8yg0z.md)
- [init(red:green:blue:colorSpace:)](coreimage/cicolor/init(red:green:blue:colorspace:)-6d8o.md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSSecureCoding](foundation/nssecurecoding.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Filters

- [CIFilter](coreimage/cifilter-swift.class.md)
- [CIRAWFilter](coreimage/cirawfilter.md)
- [CIVector](coreimage/civector.md)
