---
title: "init(white:alpha:)"
framework: uikit
role: symbol
role_heading: Initializer
path: "uikit/uicolor/init(white:alpha:)"
---

# init(white:alpha:)

Creates a color object using the specified opacity and grayscale values.

## Declaration

```swift
init(white: CGFloat, alpha: CGFloat)
```

## Parameters

- `white`: The grayscale value of the color object. On applications linked for iOS 10 or later, the color is specified in an extended color space, and the input value is never clamped. On earlier versions of iOS, white values below 0.0 are interpreted as 0.0, and values above 1.0 are interpreted as 1.0.
- `alpha`: The opacity value of the color object, specified as a value from 0.0 to 1.0. Alpha values below 0.0 are interpreted as 0.0, and values above 1.0 are interpreted as 1.0.

## Return Value

Return Value An initialized color object. The color information represented by this object is in the device gray colorspace.

## Discussion

Discussion On applications linked on iOS 10 or later, the input parameters are not clamped. On earlier versions of iOS, values below 0.0 are interpreted as 0.0, and values above 1.0 are interpreted as 1.0.

## See Also

### Creating a color from component values

- [init(hue:saturation:brightness:alpha:)](uikit/uicolor/init(hue:saturation:brightness:alpha:).md)
- [init(red:green:blue:alpha:)](uikit/uicolor/init(red:green:blue:alpha:).md)
- [init(red:green:blue:alpha:exposure:)](uikit/uicolor/init(red:green:blue:alpha:exposure:).md)
- [init(red:green:blue:alpha:linearExposure:)](uikit/uicolor/init(red:green:blue:alpha:linearexposure:).md)
- [init(displayP3Red:green:blue:alpha:)](uikit/uicolor/init(displayp3red:green:blue:alpha:).md)
- [init(named:)](uikit/uicolor/init(named:).md)
- [init(named:inBundle:compatibleWithTraitCollection:)](uikit/uicolor/init(named:inbundle:compatiblewithtraitcollection:).md)
