<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/backgroundStyle(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE15backgroundStyleyQrqd__AA05ShapeE0Rd__lF"
  },
  "title" : "backgroundStyle(_:)"
}
-->

# backgroundStyle(_:)

Sets the specified style to render backgrounds within the view.

```
nonisolated func backgroundStyle<S>(_ style: S) -> some View where S : ShapeStyle
```

## Discussion

The following example uses this modifier to set the
[`backgroundStyle`](/documentation/SwiftUI/EnvironmentValues/backgroundStyle) environment value to a
[`blue`](/documentation/SwiftUI/ShapeStyle/blue) color that includes a subtle [`gradient`](/documentation/SwiftUI/Color/gradient).
SwiftUI fills the [`Circle`](/documentation/SwiftUI/Circle) shape that acts as a background element
with this style:

```
Image(systemName: "swift")
    .padding()
    .background(in: Circle())
    .backgroundStyle(.blue.gradient)
```

![An image of the Swift logo inside a circle that’s blue with a slight](images/com.apple.SwiftUI/View-backgroundStyle-1-iOS@2x.png)

To restore the default background style, set the
[`backgroundStyle`](/documentation/SwiftUI/EnvironmentValues/backgroundStyle) environment value to
`nil` using the [`environment(_:_:)`](/documentation/SwiftUI/View/environment(_:_:)) modifer:

```
.environment(\.backgroundStyle, nil)
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)