Contents

opacity(_:)

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

Declaration

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

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