---
title: "init(colorSpace:hue:saturation:brightness:alpha:)"
framework: appkit
role: symbol
role_heading: Initializer
path: "appkit/nscolor/init(colorspace:hue:saturation:brightness:alpha:)"
---

# init(colorSpace:hue:saturation:brightness:alpha:)

Creates a color object with the specified color space, hue, saturation, brightness, and alpha channel values.

## Declaration

```swift
init(colorSpace space: NSColorSpace, hue: CGFloat, saturation: CGFloat, brightness: CGFloat, alpha: CGFloat)
```

## Parameters

- `space`: An NSColorSpace object representing a color space. An exception is raised if the color model of the provided color space is not RGB.
- `hue`: The hue (color) component, expressed as a floating-point value in the range 0–1.0.
- `saturation`: The color saturation component, expressed as a floating-point value in the range 0–1.0.
- `brightness`: The brightness component, expressed as a floating-point value in the range 0–1.0.
- `alpha`: The alpha (opacity), expressed as a floating-point value in the range 0 (transparent) to 1.0 (opaque).

## Return Value

Return Value The color object.

## See Also

### Creating a color using HSB components

- [init(calibratedHue:saturation:brightness:alpha:)](appkit/nscolor/init(calibratedhue:saturation:brightness:alpha:).md)
- [init(deviceHue:saturation:brightness:alpha:)](appkit/nscolor/init(devicehue:saturation:brightness:alpha:).md)
- [init(hue:saturation:brightness:alpha:)](appkit/nscolor/init(hue:saturation:brightness:alpha:).md)
