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

# accentColor(_:)

Sets the accent color for this view and the views it contains.

## Declaration

```swift
nonisolated func accentColor(_ accentColor: Color?) -> some View

```

## Parameters

- `accentColor`: The color to use as an accent color. Set the value to nil to use the inherited accent color.

## Discussion

Discussion Use accentColor(_:) when you want to apply a broad theme color to your app’s user interface. Some styles of controls use the accent color as a default tint color. note: In macOS, SwiftUI applies customization of the accent color only if the user chooses Multicolor under General > Accent color in System Preferences. In the example below, the outer VStack contains two child views. The first is a button with the default accent color. The second is a VStack that contains a button and a slider, both of which adopt the purple accent color of their containing view. Note that the Text element used as a label alongside the Slider retains its default color. VStack(spacing: 20) {     Button(action: {}) {         Text("Regular Button")     }     VStack {         Button(action: {}) {             Text("Accented Button")         }         HStack {             Text("Accented Slider")             Slider(value: $sliderValue, in: -100...100, step: 0.1)         }     }     .accentColor(.purple) }

## See Also

### Graphics and rendering modifiers

- [mask(_:)](swiftui/view/mask(_:).md)
- [animation(_:)](swiftui/view/animation(_:)-1hc0p.md)
- [cornerRadius(_:antialiased:)](swiftui/view/cornerradius(_:antialiased:).md)
