The contrast level controls are already in Android 14 DP2

Turns out we don’t have to wait and see because contrast level controls are already in Android 14 DP2! A new “contrast level” slider is buried under Settings > Accessibility > Color and Motion. It currently only supports “Standard”, medium, and “High” values. This slider controls the value of Settings.Secure.contrast_level (0 for “Standard”, 0.5 for the mid setting, and 1.0 for “High”) which in turn can be read by apps calling AccessibilityManager’s new getUiContrast() method.

SystemUI’s ThemeOverlayController class calls that method to read the color contrast value and generate the “dynamic” color scheme accordingly, which is then mapped to the R.color values I mentioned before through the “dynamic” FRRO.

I dumped the values of the “dynamic” FRRO generated based on the AOSP wallpaper and contrast_level values of 0, 0.5, and 1.0. It’s evident that as the contrast increases, the tone (lightness) of foreground colors becomes further from the tone of background colors.

Google’s official explanation of the dynamic scheme (H/T @kdrag0n):

"Colors without backgrounds do not change tone when contrast changes. Colors with backgrounds become closer to their background as contrast lowers, and further when contrast increases.

How this ends up looking in apps depends on how devs choose which tokens to color which UI elements, but in general, devs adhering to Material You guidelines and using the Material components library won’t need to worry about the implementation/handling of contrast level changes.

FOLLOW US ON – Telegram, Twitter, Facebook and Google News

Leave a Comment