---
title: "backgroundStyle(_:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/backgroundstyle(_:)"
---

# backgroundStyle(_:)

Sets the specified style to render backgrounds within the view.

## Declaration

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

```

## Discussion

Discussion The following example uses this modifier to set the backgroundStyle environment value to a blue color that includes a subtle gradient. SwiftUI fills the Circle shape that acts as a background element with this style: Image(systemName: "swift")     .padding()     .background(in: Circle())     .backgroundStyle(.blue.gradient)

To restore the default background style, set the backgroundStyle environment value to nil using the environment(_:_:) modifer: .environment(\.backgroundStyle, nil)

## See Also

### Styling content

- [border(_:width:)](swiftui/view/border(_:width:).md)
- [foregroundStyle(_:)](swiftui/view/foregroundstyle(_:).md)
- [foregroundStyle(_:_:)](swiftui/view/foregroundstyle(_:_:).md)
- [foregroundStyle(_:_:_:)](swiftui/view/foregroundstyle(_:_:_:).md)
- [backgroundStyle](swiftui/environmentvalues/backgroundstyle.md)
- [ShapeStyle](swiftui/shapestyle.md)
- [AnyShapeStyle](swiftui/anyshapestyle.md)
- [Gradient](swiftui/gradient.md)
- [MeshGradient](swiftui/meshgradient.md)
- [AnyGradient](swiftui/anygradient.md)
- [ShadowStyle](swiftui/shadowstyle.md)
- [Glass](swiftui/glass.md)
