---
title: luminanceToAlpha
framework: swiftui
role: symbol
role_heading: Type Property
path: swiftui/graphicscontext/filter/luminancetoalpha
---

# luminanceToAlpha

Returns a filter that sets the opacity of each pixel based on its luminance.

## Declaration

```swift
static var luminanceToAlpha: GraphicsContext.Filter { get }
```

## Return Value

Return Value A filter that applies a luminance to alpha transformation.

## Discussion

Discussion The filter computes the luminance of each pixel and uses it to define the opacity of the result, combined with black (zero) color components.

## See Also

### Adjusting opacity

- [alphaThreshold(min:max:color:)](swiftui/graphicscontext/filter/alphathreshold(min:max:color:).md)
