<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSColorSpace",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSColorSpace"
  },
  "title" : "NSColorSpace"
}
-->

# NSColorSpace

An object that represents a custom color space.

```
class NSColorSpace
```

## Overview

You can make custom color spaces from ColorSync profiles or from ICC profiles. [`NSColorSpace`](/documentation/AppKit/NSColorSpace) also has factory methods that return objects representing the system color spaces.

You can use the [`init(colorSpace:components:count:)`](/documentation/AppKit/NSColor/init(colorSpace:components:count:)) method of the [`NSColor`](/documentation/AppKit/NSColor) class to create color objects using custom [`NSColorSpace`](/documentation/AppKit/NSColorSpace) objects. You can also send the [`usingColorSpace(_:)`](/documentation/AppKit/NSColor/usingColorSpace(_:)) message to an [`NSColor`](/documentation/AppKit/NSColor) object to convert it between two color spaces, either of which may be a custom color space.

## Topics

### Getting a Named Color Space

[`deviceRGBColorSpace`](/documentation/AppKit/NSColorSpace/deviceRGB)

A color space object that represents a calibrated or device-dependent RGB color space.

[`genericRGBColorSpace`](/documentation/AppKit/NSColorSpace/genericRGB)

A color space object that represents a device-independent RGB color space.

[`deviceCMYKColorSpace`](/documentation/AppKit/NSColorSpace/deviceCMYK)

A color space object that represents a calibrated or device-dependent CMYK color space.

[`genericCMYKColorSpace`](/documentation/AppKit/NSColorSpace/genericCMYK)

A color space object that represents a device-independent CMYK color space.

[`deviceGrayColorSpace`](/documentation/AppKit/NSColorSpace/deviceGray)

A color space object that represents a calibrated or device-dependent gray color space.

[`genericGrayColorSpace`](/documentation/AppKit/NSColorSpace/genericGray)

A color space object that represents a device-independent gray color space.

[`sRGBColorSpace`](/documentation/AppKit/NSColorSpace/sRGB)

A color space object that represents an sRGB color space.

[`extendedSRGBColorSpace`](/documentation/AppKit/NSColorSpace/extendedSRGB)

A color space object that represents an extended sRGB color space.

[`displayP3ColorSpace`](/documentation/AppKit/NSColorSpace/displayP3)

A color space object that represents a P3 Display color space.

[`genericGamma22GrayColorSpace`](/documentation/AppKit/NSColorSpace/genericGamma22Gray)

A color space object that represents a gray color space with a gamma value of 2.2.

[`extendedGenericGamma22GrayColorSpace`](/documentation/AppKit/NSColorSpace/extendedGenericGamma22Gray)

A color space object that represents an extended gray color space with a gamma value of 2.2.

[`adobeRGB1998ColorSpace`](/documentation/AppKit/NSColorSpace/adobeRGB1998)

A color space object that represents an Adobe RGB (1998) color space.

### Getting the Color Spaces Available On the System

[`+  availableColorSpacesWithModel:`](/documentation/AppKit/NSColorSpace/availableColorSpaces(with:))

Returns the list of color spaces available on the system that are displayed in the color panel, in the order they are displayed in the color panel.

### Initializing a Custom Color Space Object

[`-  initWithCGColorSpace:`](/documentation/AppKit/NSColorSpace/init(cgColorSpace:)-889nv)

Initializes and returns a color space object initialized from a Core Graphics color-space object.

[`-  initWithColorSyncProfile:`](/documentation/AppKit/NSColorSpace/init(colorSyncProfile:))

Initializes and returns a color space object from the specified ColorSync profile.

[`-  initWithICCProfileData:`](/documentation/AppKit/NSColorSpace/init(iccProfileData:)-8rl9d)

Initializes and returns a color space object from the specified ICC profile.

### Accessing Color Space Data and Attributes

[`CGColorSpace`](/documentation/AppKit/NSColorSpace/cgColorSpace)

The Core Graphics color-space object that represents a color space equivalent to the color space’s.

[`colorSpaceModel`](/documentation/AppKit/NSColorSpace/colorSpaceModel)

The model on which the color space is based.

[`Model`](/documentation/AppKit/NSColorSpace/Model)

Constants that describe the abstract model on which color space objects are based.

[`colorSyncProfile`](/documentation/AppKit/NSColorSpace/colorSyncProfile)

The ColorSync profile from which the color space was created.

[`ICCProfileData`](/documentation/AppKit/NSColorSpace/iccProfileData)

The ICC profile data from which the color space was created.

[`localizedName`](/documentation/AppKit/NSColorSpace/localizedName)

The localized name of the color space.

[`numberOfColorComponents`](/documentation/AppKit/NSColorSpace/numberOfColorComponents)

The number of components, excluding alpha, the color space supports.

## Relationships

### Conforms To

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Equatable`](/documentation/Swift/Equatable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`NSCoding`](/documentation/Foundation/NSCoding)

[`Hashable`](/documentation/Swift/Hashable)

[`CVarArg`](/documentation/Swift/CVarArg)

[`NSSecureCoding`](/documentation/Foundation/NSSecureCoding)

[`Sendable`](/documentation/Swift/Sendable)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

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)