preface

The Oreo version of Android is starting to receive color management support to help calibrate colors for different devices. With this update, Android devices now display out-of-srGB colors.

In short, color management ensures that colors look consistent across different monitors. If the color #ff0000 (red) appears on different technology screens, the colors may vary, with some screens displaying more saturated or intense colors than others. According to the sRGB expression, #ff0000 table a specific red (in the sRGB color space), so that the color display management can accurately produce the desired color of the audience.

Wide gamut image display

An image can be embedded in a color profile to declare the color space to which its color information belongs. Similarly, many cameras can capture a wide gamut and embed the appropriate color profile to display colors outside the standard sRGB gamut. Display images with a wide color gamut in the application should be declared in each Activity, that is, in the manifest Activity set the colorMode attribute:

Window
onCreate

Active Windows use more memory and GPU processing power to combine images when wide gamut mode is enabled. Before enabling wide-gamut mode, carefully consider whether your activity will actually benefit from it. A full-screen photo activity works well with a wide color gamut while a thumbnail interface doesn't.Copy the code

Note that with a single Activity architecture it might make sense to split the wide-gamut image display into a new Activity.

The following example presents two test image screens that Display the same wide gamut (PNG file embedded in the Display P3 color configuration file), with the upper part of the screen declaring the wide gamut color mode for the Activity and the lower part not declaring the Activity. Screen support should see a small Android robot on the top and not on the bottom.

Color accurate rendering

Many Android devices have long had large color gamut screens. Everything before Android 8.0 color management is assumed to be sRGB, but the wide gamut display reinterprets the color values as its working gamut and effectively converts the color values (generally red more red, green more green) to a more saturated image effect. However, such stretching is not accurate, and there is no actual conversion algorithm to predict the desired color.

Many applications already manipulate resources such as images, such as desaturating some of them for color compensation. Colors may be soft on devices with a calibrated display function. On devices with accurate color display (such as Pixel 2), the image resource display will not be as rich as that on devices with inaccurate color display. As accurate color rendering becomes more popular, app developers don’t have to deal with resource colors and ensure that content is displayed on schedule. However, steps can be taken to ensure content looks great on color accurate monitors and non-color management devices.

Android 8.0 added a new WidECG resource qualifier that changes colors on devices equipped with wide gamet screens to support wide gamet rendering (nowidECG does the opposite).

Note that wide gamut support differs from whether the current activity is running in wideColorGamut color mode. This qualifier applies if the device supports color accurate rendering, regardless of whether the activity is running in wide gamut mode.

The application can declare a primary color palette in res/values/colors.xml:

res/values-widecg/colors.xml

res/drawable-widecg-mdpi/foo.png

More support is on the way

Although it recently announced plans to add a saturated color mode that lets users opt out of accurate color rendering (like the NowidECG device), it’s important to update apps for devices that have color management capabilities. Update the app to better support accurate color rendering, fewer users will opt out of this mode, after all, people prefer accurate colors. Therefore, we plan to continue to invest in the wide gamut support area and add more APIS to handle the wide gamut in future releases (for example, the updated Paint API and Canvas API already accept higher bit precision colors).

Working with modern display devices, designers and developers need to understand color space, color management and how to implement it in their applications. As more and more devices begin to offer wide gamut displays and accurate color rendering, it’s important to stay one step ahead and update your app to provide the best possible experience for your users. This is the best way to deliver a great experience to the user, making sure that the color the user sees is the color the developer wants to show.