SwiftUI Color.accent
.accentColorComplete technical specification and developer reference for Accent in Apple's SwiftUI design system. In light appearance, it resolves to HEX #007AFF; in dark appearance, it dynamically adapts to HEX #007AFF. Features wide-gamut Display P3 values, UIKit bridge (UIColor.tintColor), AppKit bridge (NSColor.controlAccentColor), WCAG contrast audit, and Xcode drop-in initializers.
SwiftUI's accent color on the current runtime.
Color.accentColorColor(red: 0.000, green: 0.478, blue: 1.000)Color(red: 0.000, green: 0.478, blue: 1.000, opacity: 1.00)Color(hue: 0.587, saturation: 1.000, brightness: 1.000, opacity: 1.00)Color(.displayP3, red: 0.204, green: 0.471, blue: 0.965, opacity: 1.00)Color(.sRGB, red: 0.000, green: 0.478, blue: 1.000, opacity: 1.00)Color(hex: "#007AFF")#colorLiteral(red: 0.000, green: 0.478, blue: 1.000, alpha: 1.00)Color(uiColor: UIColor(red: 0.000, green: 0.478, blue: 1.000, alpha: 1.00))Technical Color Specifications
Exact resolved HEX codes, sRGB 8-bit components, HSL, and normalized Swift floating-point decimals for Light and Dark modes.
| Color Metric / Space | Light Appearance | Dark Appearance | Swift Code Literal |
|---|---|---|---|
| HEX Code | #007AFF | #007AFF | Color(hex: "#007AFF") |
| sRGB (0–255) | rgb(0, 122, 255) | rgb(0, 122, 255) | (r: 0.000, g: 0.478, b: 1.000) |
| Display P3 (Wide Gamut) | P3 (0.204, 0.471, 0.965) | P3 (0.204, 0.471, 0.965) | Color(.displayP3, ...) |
| HSL / HSB | hsl(211, 100%, 50%) | hsl(211, 100%, 50%) | Color(hue:sat:bri:) |
| Platform Bridge | UIKit: UIColor.tintColor | AppKit: NSColor.controlAccentColor | Color(uiColor:) / Color(nsColor:) |
Light Appearance
#007AFFrgb(0, 122, 255)hsl(211, 100%, 50%)(r: 0.000, g: 0.478, b: 1.000)Dark Appearance
#007AFFrgb(0, 122, 255)hsl(211, 100%, 50%)(r: 0.000, g: 0.478, b: 1.000)Drop-In Developer Snippets
Ready-to-paste code blocks for Xcode asset catalogs and Swift files.
Contents.json inside Assets.xcassets/Accent.colorset/{
"colors": [
{
"color": {
"color-space": "srgb",
"components": {
"red": "0.000",
"green": "0.478",
"blue": "1.000",
"alpha": "1.000"
}
},
"idiom": "universal"
},
{
"appearances": [
{
"appearance": "luminosity",
"value": "dark"
}
],
"color": {
"color-space": "srgb",
"components": {
"red": "0.000",
"green": "0.478",
"blue": "1.000",
"alpha": "1.000"
}
},
"idiom": "universal"
}
],
"info": {
"author": "xcode",
"version": 1
}
}Live UI Component Sandbox
Preview Color.accent inside standard Apple interface components.
●SwiftUI Notification
Just nowDemonstrates how Apple designers pair system background tints with dynamic Accent accents.
.foregroundStyle(.accentColor)
Platform Implementation Snippets
Ready-to-use Swift code for SwiftUI, UIKit, and AppKit applications.
// Standard SwiftUI Usage
Text("Hello, Apple")
.foregroundStyle(Color.accentColor)
// Background & Shape Fill
RoundedRectangle(cornerRadius: 16)
.fill(Color.accentColor)
.frame(width: 200, height: 50)
// Prominent Action Button
Button("Confirm Action") {
// Action
}
.buttonStyle(.borderedProminent)
.tint(Color.accentColor)WCAG 2.1 Accessibility Contrast Audit
Contrast calculations of Accent against pure white and iOS OLED dark surfaces.
Recommended HIG Use Cases
- Primary interactive controls and buttons
- Navigation highlights and active tab bar items
- Selection outlines, checkboxes, and focus rings
Anti-Patterns to Avoid
- Non-clickable decorative fills
- Heavy background fills that overpower foreground content
Browse More SwiftUI Colors
Quickly jump to other Apple system colors and semantic tokens.
Frequently Asked Questions
How do I use Color.accent in SwiftUI?
In SwiftUI, apply the color directly using view modifiers like .foregroundStyle(.accentColor), .tint(.accentColor), or .background(.accentColor). You can also instantiate it via Color.accentColor.
What is the HEX code for SwiftUI Accent in light and dark mode?
In light appearance, SwiftUI Accent resolves to #007AFF. In dark appearance, it automatically adapts to #007AFF.
What is the UIKit and AppKit equivalent of SwiftUI Color.accent?
The UIKit equivalent is UIColor.tintColor (accessible in SwiftUI via Color(uiColor: .tintColor)). The AppKit equivalent is NSColor.controlAccentColor (accessible via Color(nsColor: .controlAccentColor)).
Does SwiftUI Color.accent adapt automatically to dark mode?
Yes, Color.accentColor is a dynamic Apple system token that automatically updates between light (#007AFF) and dark (#007AFF) appearances when the system appearance changes.
What is the Display P3 and sRGB value of Color.accent?
Color.accent uses resolved sRGB values (#007AFF in light, #007AFF in dark) and supports wide color gamut Display P3 coordinates for high-fidelity rendering on Apple Retina displays.