P3 Color Support
P3 Color Support
P3 color support enables design systems to use the Display P3 color space, which represents approximately 25% more colors than sRGB. Apple has championed P3 adoption across iOS, macOS, and their ecosystem. Implementing P3 support allows design systems to achieve more vibrant colors on devices with P3-capable displays while maintaining compatibility with sRGB devices.
What Is P3 Color Support
Display P3 is a wide gamut color space based on the DCI-P3 cinema standard, adapted for Apple displays. P3 can represent highly saturated colors, particularly reds and greens, that sRGB cannot. Since iPhone 7, all Apple devices with screens have supported P3.
P3 support requires intentional implementation. Standard color specifications (hex, rgb()) are interpreted as sRGB. Accessing P3 requires platform-specific APIs or CSS Color Level 4 syntax. Without explicit P3 specification, designs use only sRGB even on P3-capable devices.
Design systems implementing P3 support can specify brand colors that would be approximated (clipped) in sRGB, achieving the exact intended appearance on P3 displays while providing reasonable sRGB fallbacks elsewhere.
How P3 Color Support Works
iOS and macOS provide native P3 support through UIKit and SwiftUI APIs. Colors can be created directly in P3 color space. Asset catalogs support P3 color sets that automatically select appropriate representation.
P3 Implementation by Platform:
iOS/macOS UIKit:
let p3Color = UIColor(displayP3Red: 1.0, green: 0.3, blue: 0.1, alpha: 1.0)
iOS/macOS SwiftUI:
Color(.displayP3, red: 1.0, green: 0.3, blue: 0.1)
Asset Catalog:
- Create Color Set
- Set "Gamut" to "Any, sRGB" or "Any, sRGB, P3"
- Specify P3 color values for P3 variant
CSS:
/* P3 with sRGB fallback */
.brand-color {
background: #ff5500; /* sRGB fallback */
background: color(display-p3 1 0.35 0);
}
/* Check support */
@supports (color: color(display-p3 1 0 0)) {
.brand-color {
background: color(display-p3 1 0.35 0);
}
}
Browser Support (2024):
- Safari: Full support
- Chrome: Supported
- Firefox: Supported
- Edge: Supported (Chromium-based)
Web P3 support uses CSS Color Level 4. The color() function accepts color space as first argument. Feature queries (@supports) enable progressive enhancement with sRGB fallback.
Asset pipeline considerations apply when working with images. Images can embed P3 ICC profiles. Design tools can export in P3. Build pipelines should preserve color profiles during optimization.
Token systems can accommodate P3. Tokens might store both sRGB and P3 values, with transformations outputting appropriate format for each target platform.
Key Considerations
- P3 colors require explicit specification on all platforms
- sRGB fallbacks needed for non-P3 contexts
- Asset catalogs simplify iOS P3 management
- Web P3 requires CSS Color Level 4 syntax
- Design tools must be configured for P3 export
- Testing requires both P3 and sRGB displays
Common Questions
How do design systems define colors for both P3 and sRGB?
Dual specification provides values for both color spaces. Token definitions include p3Red, p3Green, p3Blue alongside srgbRed, srgbGreen, srgbBlue values.
Automatic conversion can approximate sRGB from P3. However, out-of-gamut P3 colors require decisions about how to map to sRGB (desaturate, shift hue, or clip).
Manual curation ensures optimal appearance in both spaces. For brand-critical colors, designers may hand-tune sRGB fallbacks rather than relying on automatic conversion.
Asset catalogs on iOS allow specifying both representations. The system selects appropriate representation automatically based on device capabilities.
How do teams test P3 implementation?
Device testing on P3 displays verifies intended appearance. Modern iPhones, iPads, Macs with Retina displays, and some Android devices have P3 displays.
sRGB device testing verifies fallback behavior. Older devices, many external monitors, and some contexts display sRGB only. Testing confirms acceptable fallback appearance.
Simulator settings on Xcode can change color gamut for testing. This helps verify fallback behavior without requiring physical sRGB devices.
Side-by-side comparison reveals whether P3 adds meaningful value. If P3 and sRGB versions look nearly identical, P3 complexity may not be justified.
What are common P3 implementation mistakes?
Specifying P3 values in sRGB APIs does not work. Using P3 numeric values in rgb() or hex produces wrong colors because those formats assume sRGB.
Missing fallbacks cause problems on sRGB devices. Colors outside sRGB gamut clip to the gamut boundary, potentially appearing different than intended.
Assuming all users have P3 displays ignores significant device populations. Many desktop monitors, older devices, and some contexts are sRGB only.
Not preserving color profiles during image optimization strips P3 information. Images may fall back to sRGB even when originally P3.
Summary
P3 color support enables design systems to use wider color gamut on modern Apple devices and P3-capable displays. Implementation requires explicit P3 color space specification through platform APIs or CSS Color Level 4. Design systems must provide sRGB fallbacks for devices without P3 support. Testing on both P3 and sRGB displays validates implementation and ensures acceptable appearance across the device spectrum.
Buoy scans your codebase for design system inconsistencies before they ship
Detect Design Drift Free