SwiftUI Color.purple
.purpleComplete technical specification and developer reference for Purple in Apple's SwiftUI design system. In light appearance, it resolves to HEX #CB30E0; in dark appearance, it dynamically adapts to HEX #DB34F2. Features wide-gamut Display P3 values, UIKit bridge (UIColor.systemPurple), AppKit bridge (NSColor.systemPurple), WCAG contrast audit, and Xcode drop-in initializers.
SwiftUI's adaptable purple.
Color.purpleColor(red: 0.796, green: 0.188, blue: 0.878)Color(red: 0.796, green: 0.188, blue: 0.878, opacity: 1.00)Color(hue: 0.813, saturation: 0.786, brightness: 0.878, opacity: 1.00)Color(.displayP3, red: 0.733, green: 0.243, blue: 0.851, opacity: 1.00)Color(.sRGB, red: 0.796, green: 0.188, blue: 0.878, opacity: 1.00)Color(hex: "#CB30E0")#colorLiteral(red: 0.796, green: 0.188, blue: 0.878, alpha: 1.00)Color(uiColor: UIColor(red: 0.796, green: 0.188, blue: 0.878, 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 | #CB30E0 | #DB34F2 | Color(hex: "#CB30E0") |
| sRGB (0–255) | rgb(203, 48, 224) | rgb(219, 52, 242) | (r: 0.796, g: 0.188, b: 0.878) |
| Display P3 (Wide Gamut) | P3 (0.733, 0.243, 0.851) | P3 (0.792, 0.263, 0.918) | Color(.displayP3, ...) |
| HSL / HSB | hsl(293, 74%, 53%) | hsl(293, 88%, 58%) | Color(hue:sat:bri:) |
| Platform Bridge | UIKit: UIColor.systemPurple | AppKit: NSColor.systemPurple | Color(uiColor:) / Color(nsColor:) |
Light Appearance
#CB30E0rgb(203, 48, 224)hsl(293, 74%, 53%)(r: 0.796, g: 0.188, b: 0.878)Dark Appearance
#DB34F2rgb(219, 52, 242)hsl(293, 88%, 58%)(r: 0.859, g: 0.204, b: 0.949)Drop-In Developer Snippets
Ready-to-paste code blocks for Xcode asset catalogs and Swift files.
Contents.json inside Assets.xcassets/Purple.colorset/{
"colors": [
{
"color": {
"color-space": "srgb",
"components": {
"red": "0.796",
"green": "0.188",
"blue": "0.878",
"alpha": "1.000"
}
},
"idiom": "universal"
},
{
"appearances": [
{
"appearance": "luminosity",
"value": "dark"
}
],
"color": {
"color-space": "srgb",
"components": {
"red": "0.859",
"green": "0.204",
"blue": "0.949",
"alpha": "1.000"
}
},
"idiom": "universal"
}
],
"info": {
"author": "xcode",
"version": 1
}
}Live UI Component Sandbox
Preview Color.purple inside standard Apple interface components.
●SwiftUI Notification
Just nowDemonstrates how Apple designers pair system background tints with dynamic Purple accents.
.foregroundStyle(.purple)
Platform Implementation Snippets
Ready-to-use Swift code for SwiftUI, UIKit, and AppKit applications.
// Standard SwiftUI Usage
Text("Hello, Apple")
.foregroundStyle(Color.purple)
// Background & Shape Fill
RoundedRectangle(cornerRadius: 16)
.fill(Color.purple)
.frame(width: 200, height: 50)
// Prominent Action Button
Button("Confirm Action") {
// Action
}
.buttonStyle(.borderedProminent)
.tint(Color.purple)WCAG 2.1 Accessibility Contrast Audit
Contrast calculations of Purple against pure white and iOS OLED dark surfaces.
Recommended HIG Use Cases
- Media categories, podcasts, and video hubs
- VIP, pro, or premium feature badges
- Data visualization and chart groupings
Anti-Patterns to Avoid
- Destructive actions
- Primary body copy
Browse More SwiftUI Colors
Quickly jump to other Apple system colors and semantic tokens.
Frequently Asked Questions
How do I use Color.purple in SwiftUI?
In SwiftUI, apply the color directly using view modifiers like .foregroundStyle(.purple), .tint(.purple), or .background(.purple). You can also instantiate it via Color.purple.
What is the HEX code for SwiftUI Purple in light and dark mode?
In light appearance, SwiftUI Purple resolves to #CB30E0. In dark appearance, it automatically adapts to #DB34F2.
What is the UIKit and AppKit equivalent of SwiftUI Color.purple?
The UIKit equivalent is UIColor.systemPurple (accessible in SwiftUI via Color(uiColor: .systemPurple)). The AppKit equivalent is NSColor.systemPurple (accessible via Color(nsColor: .systemPurple)).
Does SwiftUI Color.purple adapt automatically to dark mode?
Yes, Color.purple is a dynamic Apple system token that automatically updates between light (#CB30E0) and dark (#DB34F2) appearances when the system appearance changes.
What is the Display P3 and sRGB value of Color.purple?
Color.purple uses resolved sRGB values (#CB30E0 in light, #DB34F2 in dark) and supports wide color gamut Display P3 coordinates for high-fidelity rendering on Apple Retina displays.