---
title: "opacity(_:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/visualeffect/opacity(_:)"
---

# opacity(_:)

Sets the transparency of the view.

## Declaration

```swift
func opacity(_ opacity: Double) -> some VisualEffect

```

## Parameters

- `opacity`: A value between 0 (fully transparent) and 1 (fully opaque).

## Return Value

Return Value An effect that sets the transparency of the view.

## Discussion

Discussion When applying the opacity(_:) effect to a view that has already had its opacity transformed, the effect of the underlying opacity transformation is multiplied.

## See Also

### Adjusting Color

- [brightness(_:)](swiftui/visualeffect/brightness(_:).md)
- [colorEffect(_:isEnabled:)](swiftui/visualeffect/coloreffect(_:isenabled:).md)
- [contrast(_:)](swiftui/visualeffect/contrast(_:).md)
- [grayscale(_:)](swiftui/visualeffect/grayscale(_:).md)
- [hueRotation(_:)](swiftui/visualeffect/huerotation(_:).md)
- [saturation(_:)](swiftui/visualeffect/saturation(_:).md)
