Search Docs
Loading...
Skip to content

P3 Colors

Detect support for the Display P3 wide color gamut and switch the engine into a 16-bit P3 working color space on capable Android devices.

5 mins
estimated time
GitHub

P3 is a wide color gamut that covers roughly 25% more visible colors than sRGB, especially in the reds, oranges, and green-cyan regions. CE.SDK can render and export in a 16-bit Display P3 working space on Android devices that support it, preserving colors that would otherwise be clipped to sRGB.

What is P3?#

The DCI-P3 color space was developed for digital cinema and has been adopted in modern consumer displays. CE.SDK uses the Display P3 variant, which keeps sRGB’s gamma curve and replaces only the color primaries. Compared to sRGB:

  • Gamut size: P3 covers about 25% more visible colors
  • Primary colors: P3 red and green are more saturated
  • Precision: The P3 working space uses 16 bits per channel instead of 8, which reduces banding in gradients and color adjustments
  • Backwards compatibility: P3 content displayed on sRGB hardware is automatically converted

On sRGB displays, colors are converted for display but the underlying P3 data is preserved in exports.

Check P3 Support#

supportsP3() returns true when the engine can run in the P3 working color space on the current Android device. Use the result to decide whether to enable P3 — the setting is silently ignored on unsupported devices.

val p3IsSupported = engine.editor.supportsP3()

For a richer diagnostic, use checkP3Support() instead. It throws an exception whose message explains why P3 is unavailable, such as missing platform support, missing 16-bit float GPU support, or no P3-capable display.

try {
engine.editor.checkP3Support()
} catch (exception: Exception) {
println("P3 unavailable: ${exception.message}")
}

Enable the P3 Working Color Space#

Switch the engine into a 16-bit Display P3 pipeline by setting the features/p3WorkingColorSpace flag. The setting affects everything the editor renders, including the color picker and live preview, and image exports preserve the wider gamut by writing 16-bit Display P3 PNGs with an embedded ICC profile.

if (p3IsSupported) {
engine.editor.setSettingBoolean(
keypath = "features/p3WorkingColorSpace",
value = true,
)
}

Guard the setting with supportsP3() so your app only enables P3 when the current device can use it.

Graceful Fallback#

Combine checkP3Support() with the setting update when you want a single pattern that enables P3 where available and continues in sRGB otherwise.

try {
engine.editor.checkP3Support()
engine.editor.setSettingBoolean(
keypath = "features/p3WorkingColorSpace",
value = true,
)
} catch (exception: Exception) {
println("Staying on sRGB: ${exception.message}")
}

When the device does not support P3, the engine continues using its default 8-bit sRGB working space. Existing colors and exports remain valid; no further code changes are required.

Platform Support#

Android P3 availability depends on the device display and graphics stack:

Android RuntimeP3 Working Color Space
P3-capable display with required 16-bit float supportSupported
Missing P3 display or required GPU supportUses sRGB fallback

supportsP3() returns the runtime result, so the same code compiles and runs across Android devices without model-specific checks.

P3 vs sRGB: When to Use Each#

Use CaseRecommended
Android apps targeting wide-gamut devicesP3
Photo or video editing where color accuracy mattersP3
Importing P3 photos from modern mobile camerasP3
Cross-platform consistency across broad device rangessRGB
Smaller export filessRGB

The P3 working space exports 16-bit PNGs with an embedded Display P3 ICC profile. The doubled bit depth means files are typically about 1.67x the size of their 8-bit sRGB equivalents.

API Reference#

MethodDescription
engine.editor.supportsP3()Returns true if the device supports the P3 working color space
engine.editor.checkP3Support()Throws an exception describing why P3 is unavailable; returns normally when supported
engine.editor.setSettingBoolean(keypath="features/p3WorkingColorSpace", value=true)Enables the 16-bit Display P3 working color space when the device supports it

Next Steps#