Creates a color object from the specified components of the given color space.


init(colorSpace space: NSColorSpace, components: UnsafePointer<CGFloat>, count numberOfComponents: Int)



An NSColorSpace object representing a color space. The colorspace should be component-based. The method raises if this is nil or a color space that cannot be used with NSColor objects.


An array of the components in the specified color space to use to create the NSColor object. The order of these components is determined by the color-space profile, with the alpha component always last. (If you want the created color to be opaque, specify 1.0 for the alpha component.)


The number of components in the components array. This should match the number dictated by the specified color space plus one for alpha. This method raises an exception if they do not match.

Return Value

The color object.

See Also