<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreGraphics",
  "identifier" : "/documentation/CoreGraphics/CGColorSpace",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Core Graphics"
    ],
    "preciseIdentifier" : "c:@T@CGColorSpaceRef"
  },
  "title" : "CGColorSpace"
}
-->

# CGColorSpace

A profile that specifies how to interpret a color value for display.

```
class CGColorSpace
```

## Overview

A color space is multi-dimensional, and each dimension represents a specific color component. For example, the colors in an RGB color space have three dimensions or components—red, green, and blue. The intensity of each component is represented by floating point values—their range and meaning depends on the color space in question.

Different types of devices (scanners, monitors, printers) operate within different color spaces (RGB, CMYK, grayscale). Additionally, two devices of the same type (for example, color displays from different manufacturers) may operate within the same kind of color space, yet still produce a different range of colors, or gamut. Color spaces that are correctly specified ensure that an image has a consistent appearance regardless of the output device.

Core Graphics supports several kinds of color spaces:

- Calibrated color spaces ensure that colors appear the same when displayed on different devices. The visual appearance of the color is preserved, as far as the capabilities of the device allow.
- Device-dependent color spaces are tied to the system of color representation of a particular device. Device color spaces are not recommended when high-fidelity color preservation is important.
- Special color spaces—indexed and pattern. An indexed color space contains a color table with up to 256 entries and a base color space to which the color table entries are mapped. Each entry in the color table specifies one color in the base color space. A pattern color space is used when stroking or filling with a pattern.

## Topics

### Creating Color Spaces

[`init(calibratedGrayWhitePoint:blackPoint:gamma:)`](/documentation/CoreGraphics/CGColorSpace/init(calibratedGrayWhitePoint:blackPoint:gamma:))

Creates a calibrated grayscale color space.

[`init(calibratedRGBWhitePoint:blackPoint:gamma:matrix:)`](/documentation/CoreGraphics/CGColorSpace/init(calibratedRGBWhitePoint:blackPoint:gamma:matrix:))

Creates a calibrated RGB color space.

[`init(iccBasedNComponents:range:profile:alternate:)`](/documentation/CoreGraphics/CGColorSpace/init(iccBasedNComponents:range:profile:alternate:))

Creates a device-independent color space that is defined according to the ICC color profile specification.

[`init(indexedBaseSpace:last:colorTable:)`](/documentation/CoreGraphics/CGColorSpace/init(indexedBaseSpace:last:colorTable:))

Creates an indexed color space, consisting of colors specified by a color lookup table.

[`init(labWhitePoint:blackPoint:range:)`](/documentation/CoreGraphics/CGColorSpace/init(labWhitePoint:blackPoint:range:))

Creates a device-independent color space that is relative to human color perception, according to the CIE L*a*b* standard.

[`init(patternBaseSpace:)`](/documentation/CoreGraphics/CGColorSpace/init(patternBaseSpace:))

Creates a pattern color space.

[`init(name:)`](/documentation/CoreGraphics/CGColorSpace/init(name:))

Creates a specified type of Quartz color space.

[`init(platformColorSpaceRef:)`](/documentation/CoreGraphics/CGColorSpace/init(platformColorSpaceRef:))

Creates a platform-specific color space.

[`init(iccData:)`](/documentation/CoreGraphics/CGColorSpace/init(iccData:))

Creates an ICC-based color space using the ICC profile contained in the specified data.

[`init(propertyListPlist:)`](/documentation/CoreGraphics/CGColorSpace/init(propertyListPlist:))

Creates a color space from a property list.

[`CGColorSpaceCreateDeviceRGB()`](/documentation/CoreGraphics/CGColorSpaceCreateDeviceRGB())

Creates a device-dependent RGB color space.

[`CGColorSpaceCreateDeviceCMYK()`](/documentation/CoreGraphics/CGColorSpaceCreateDeviceCMYK())

Creates a device-dependent CMYK color space.

[`CGColorSpaceCreateDeviceGray()`](/documentation/CoreGraphics/CGColorSpaceCreateDeviceGray())

Creates a device-dependent grayscale color space.

[`init(iccProfileData:)`](/documentation/CoreGraphics/CGColorSpace/init(iccProfileData:))

Creates an ICC-based color space using the ICC profile contained in the specified data.

### Retaining and Releasing Color Spaces

[`CGColorSpaceRelease`](/documentation/CoreGraphics/CGColorSpaceRelease)

Decrements the retain count of a color space.

[`CGColorSpaceRetain`](/documentation/CoreGraphics/CGColorSpaceRetain)

Increments the retain count of a color space.

### Examining a Color Space

[`baseColorSpace`](/documentation/CoreGraphics/CGColorSpace/baseColorSpace)

Returns the base color space of a pattern or indexed color space.

[`numberOfComponents`](/documentation/CoreGraphics/CGColorSpace/numberOfComponents)

Returns the number of color components in a color space.

[`model`](/documentation/CoreGraphics/CGColorSpace/model)

Returns the color space model of the provided color space.

[`CGColorSpaceModel`](/documentation/CoreGraphics/CGColorSpaceModel)

Models for color spaces.

[`colorTable`](/documentation/CoreGraphics/CGColorSpace/colorTable)

The entries in the color table of an indexed color space.

[`copyICCData()`](/documentation/CoreGraphics/CGColorSpace/copyICCData())

Returns a copy of the ICC profile data of the provided color space.

[`copyPropertyList()`](/documentation/CoreGraphics/CGColorSpace/copyPropertyList())

Returns a copy of the color space’s properties.

[`iccData`](/documentation/CoreGraphics/CGColorSpace/iccData)

Returns a copy of the ICC profile of the provided color space.

[`name`](/documentation/CoreGraphics/CGColorSpace/name)

Returns the name used to create the specified color space.

[`supportsOutput`](/documentation/CoreGraphics/CGColorSpace/supportsOutput)

Returns a Boolean indicating whether the color space can be used as a destination color space.

[`isWideGamutRGB`](/documentation/CoreGraphics/CGColorSpace/isWideGamutRGB)

Returns whether the RGB color space covers a significant portion of the NTSC color gamut.

[`CGColorSpaceGetColorTable`](/documentation/CoreGraphics/CGColorSpaceGetColorTable)

Copies the entries in the color table of an indexed color space.

[`CGColorSpaceGetColorTableCount`](/documentation/CoreGraphics/CGColorSpaceGetColorTableCount)

Returns the number of entries in the color table of an indexed color space.

### Accessing System-Defined Color Spaces

[`displayP3`](/documentation/CoreGraphics/CGColorSpace/displayP3)

The Display P3 color space, created by Apple.

[`displayP3_HLG`](/documentation/CoreGraphics/CGColorSpace/displayP3_HLG)

The Display P3 color space, using the HLG transfer function.

[`displayP3_PQ_EOTF`](/documentation/CoreGraphics/CGColorSpace/displayP3_PQ_EOTF)

The Display P3 color space, using the PQ transfer function.

[`extendedLinearDisplayP3`](/documentation/CoreGraphics/CGColorSpace/extendedLinearDisplayP3)

The Display P3 color space with a linear transfer function and extended-range values.

[`sRGB`](/documentation/CoreGraphics/CGColorSpace/sRGB)

The standard Red Green Blue (sRGB) color space.

[`linearSRGB`](/documentation/CoreGraphics/CGColorSpace/linearSRGB)

The sRGB color space with a linear transfer function.

[`extendedSRGB`](/documentation/CoreGraphics/CGColorSpace/extendedSRGB)

The extended sRGB color space.

[`extendedLinearSRGB`](/documentation/CoreGraphics/CGColorSpace/extendedLinearSRGB)

The sRGB color space with a linear transfer function and extended-range values.

[`genericGrayGamma2_2`](/documentation/CoreGraphics/CGColorSpace/genericGrayGamma2_2)

The generic gray color space that has an exponential transfer function with a power of 2.2.

[`extendedGray`](/documentation/CoreGraphics/CGColorSpace/extendedGray)

The extended gray color space.

[`linearGray`](/documentation/CoreGraphics/CGColorSpace/linearGray)

The gray color space using a linear transfer function.

[`extendedLinearGray`](/documentation/CoreGraphics/CGColorSpace/extendedLinearGray)

The extended gray color space with a linear transfer function.

[`genericCMYK`](/documentation/CoreGraphics/CGColorSpace/genericCMYK)

The generic CMYK color space.

[`genericRGBLinear`](/documentation/CoreGraphics/CGColorSpace/genericRGBLinear)

The generic RGB color space with a linear transfer function.

[`genericXYZ`](/documentation/CoreGraphics/CGColorSpace/genericXYZ)

The XYZ color space, as defined by the CIE 1931 standard.

[`genericLab`](/documentation/CoreGraphics/CGColorSpace/genericLab)

The generic LAB color space.

[`acescgLinear`](/documentation/CoreGraphics/CGColorSpace/acescgLinear)

The ACEScg color space.

[`adobeRGB1998`](/documentation/CoreGraphics/CGColorSpace/adobeRGB1998)

The Adobe RGB (1998) color space.

[`dcip3`](/documentation/CoreGraphics/CGColorSpace/dcip3)

The DCI P3 color space, which is the digital cinema standard.

[`itur_709`](/documentation/CoreGraphics/CGColorSpace/itur_709)

The recommendation of the International Telecommunication Union (ITU) Radiocommunication sector for the BT.709 color space.

[`rommrgb`](/documentation/CoreGraphics/CGColorSpace/rommrgb)

The Reference Output Medium Metric (ROMM) RGB color space.

[`itur_2020`](/documentation/CoreGraphics/CGColorSpace/itur_2020)

The recommendation of the International Telecommunication Union (ITU) Radiocommunication sector for the BT.2020 color space.

[`itur_2020_HLG`](/documentation/CoreGraphics/CGColorSpace/itur_2020_HLG)

The recommendation of the International Telecommunication Union (ITU) Radiocommunication sector for the BT.2020 color space, with the HLG transfer function.

[`itur_2020_PQ_EOTF`](/documentation/CoreGraphics/CGColorSpace/itur_2020_PQ_EOTF)

The recommendation of the International Telecommunication Union (ITU) Radiocommunication sector for the BT.2020 color space, with the PQ transfer function.

[`extendedLinearITUR_2020`](/documentation/CoreGraphics/CGColorSpace/extendedLinearITUR_2020)

The recommendation of the International Telecommunication Union (ITU) Radiocommunication sector for the BT.2020 color space, with a linear transfer function and extended range values.

[`coreMedia709`](/documentation/CoreGraphics/CGColorSpace/coreMedia709)

[`displayP3_PQ`](/documentation/CoreGraphics/CGColorSpace/displayP3_PQ)

[`extendedDisplayP3`](/documentation/CoreGraphics/CGColorSpace/extendedDisplayP3)

[`extendedITUR_2020`](/documentation/CoreGraphics/CGColorSpace/extendedITUR_2020)

[`itur_2020_PQ`](/documentation/CoreGraphics/CGColorSpace/itur_2020_PQ)

[`itur_2020_sRGBGamma`](/documentation/CoreGraphics/CGColorSpace/itur_2020_sRGBGamma)

[`itur_2100_HLG`](/documentation/CoreGraphics/CGColorSpace/itur_2100_HLG)

[`itur_2100_PQ`](/documentation/CoreGraphics/CGColorSpace/itur_2100_PQ)

[`itur_709_HLG`](/documentation/CoreGraphics/CGColorSpace/itur_709_HLG)

[`itur_709_PQ`](/documentation/CoreGraphics/CGColorSpace/itur_709_PQ)

[`linearDisplayP3`](/documentation/CoreGraphics/CGColorSpace/linearDisplayP3)

[`linearITUR_2020`](/documentation/CoreGraphics/CGColorSpace/linearITUR_2020)

[`kCGColorSpaceGenericRGB`](/documentation/CoreGraphics/kCGColorSpaceGenericRGB)

The name of the generic RGB color space.

[`kCGColorSpaceGenericGray`](/documentation/CoreGraphics/kCGColorSpaceGenericGray)

The name of the generic gray color space.

### Working with Core Foundation Types

[`typeID`](/documentation/CoreGraphics/CGColorSpace/typeID)

Returns the Core Foundation type identifier for Quartz color spaces.

### Data Types

[`CGColorRenderingIntent`](/documentation/CoreGraphics/CGColorRenderingIntent)

Handling options for colors that are not located within the destination color space of a graphics context.

### Instance Methods

[`isHDR()`](/documentation/CoreGraphics/CGColorSpace/isHDR())

## See Also

  [Quartz 2D Programming Guide](https://developer.apple.com/library/archive/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/Introduction/Introduction.html#//apple_ref/doc/uid/TP30001066)



---

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)