Class

NSColorSpace

An object that represents a custom color spaces.

Overview

You can make custom color spaces from ColorSync profiles or from ICC profiles. NSColorSpace also has factory methods that return objects representing the system color spaces.

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

Topics

Getting the Color Spaces Available On the System

class func availableColorSpaces(with: NSColorSpace.Model)

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 NSColorSpace Object

init?(cgColorSpace: CGColorSpace)

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

init?(colorSyncProfile: UnsafeMutableRawPointer)

Initializes and returns an NSColorSpace object given a ColorSync profile.

init?(iccProfileData: Data)

Initializes and returns an NSColorSpace object given an ICC profile.

Accessing Color-Space Data and Attributes

var cgColorSpace: CGColorSpace?

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

var colorSpaceModel: NSColorSpace.Model

The model on which the color space of the receiver is based.

var colorSyncProfile: UnsafeMutableRawPointer?

The ColorSync profile from which the receiver was created.

var iccProfileData: Data?

The ICC profile data from which the receiver was created.

var localizedName: String?

The localized name of the receiver

var numberOfColorComponents: Int

The number of components (excluding alpha) the receiver supports or zero if the receiver is not based on float components.

Constants

enum NSColorSpace.Model

The type of the color-space mode constants listed in Color Space Models.

Color Space Models

Identify the abstract model on which an NSColorSpace object is based.

Type Properties

class var adobeRGB1998: NSColorSpace

Returns an NSColorSpace object representing an Adobe RGB (1998) color space.

class var deviceCMYK: NSColorSpace

Returns an NSColorSpace object representing a calibrated or device-dependent CMYK color space.

class var deviceGray: NSColorSpace

Returns an NSColorSpace object representing a calibrated or device-dependent gray color space.

class var deviceRGB: NSColorSpace

Returns an NSColorSpace object representing a calibrated or device-dependent RGB color space.

class var displayP3: NSColorSpace

Returns an NSColorSpace object representing a P3 Display color space.

class var extendedGenericGamma22Gray: NSColorSpace

Returns an NSColorSpace object representing an extended gray color space with a gamma value of 2.2.

class var extendedSRGB: NSColorSpace

Returns an NSColorSpace object representing an extended sRGB color space.

class var genericCMYK: NSColorSpace

Returns an NSColorSpace object representing a device-independent CMYK color space.

class var genericGamma22Gray: NSColorSpace

Returns an NSColorSpace object representing a gray color space with a gamma value of 2.2.

class var genericGray: NSColorSpace

Returns an NSColorSpace object representing a device-independent gray color space.

class var genericRGB: NSColorSpace

Returns an NSColorSpace object representing a device-independent RGB color space.

class var sRGB: NSColorSpace

Returns an NSColorSpace object representing an sRGB color space.

Relationships

Inherits From

See Also

Colors

class NSColor

An object that stores color data and sometimes opacity (alpha value).

class NSColorList

An ordered list of NSColor objects, identified by keys.