---
title: "opacity(_:)"
framework: swiftui
role: symbol
role_heading: Type Method
path: "swiftui/shapestyle/opacity(_:)-swift.type.method"
---

# opacity(_:)

Returns a new style based on the current style that multiplies by opacity when drawing.

## Declaration

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

```

## Discussion

Discussion In most contexts the current style is the foreground but e.g. when setting the value of the background style, that becomes the current implicit style. For example, a circle filled with the current foreground style at fifty-percent opacity: Circle().fill(.opacity(0.5))

## See Also

### Configuring the default shape style

- [blendMode(_:)](swiftui/shapestyle/blendmode(_:)-swift.type.method.md)
- [shadow(_:)](swiftui/shapestyle/shadow(_:)-swift.type.method.md)
