---
title: "init(deviceRed:green:blue:alpha:)"
framework: appkit
role: symbol
role_heading: Initializer
path: "appkit/nscolor/init(devicered:green:blue:alpha:)"
---

# init(deviceRed:green:blue:alpha:)

Creates a color object using the given opacity value and RGB components.

## Declaration

```swift
init(deviceRed red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat)
```

## Parameters

- `red`: The red component of the color object.
- `green`: The green component of the color object.
- `blue`: The blue component of the color object.
- `alpha`: The opacity value of the color object.

## Return Value

Return Value The color object.

## Discussion

Discussion Values below 0.0 are interpreted as 0.0, and values above 1.0 are interpreted as 1.0.

## See Also

### Related Documentation

- [getRed(_:green:blue:alpha:)](appkit/nscolor/getred(_:green:blue:alpha:).md)
- [init(deviceHue:saturation:brightness:alpha:)](appkit/nscolor/init(devicehue:saturation:brightness:alpha:).md)

### Creating a color using RGB components

- [init(srgbRed:green:blue:alpha:)](appkit/nscolor/init(srgbred:green:blue:alpha:)-9oz51.md)
- [init(displayP3Red:green:blue:alpha:)](appkit/nscolor/init(displayp3red:green:blue:alpha:).md)
- [init(red:green:blue:alpha:)](appkit/nscolor/init(red:green:blue:alpha:).md)
- [init(calibratedRed:green:blue:alpha:)](appkit/nscolor/init(calibratedred:green:blue:alpha:).md)
