Android 12’s Material You theming system has been recreated by a developer
Material You’s wallpaper-based theming system, codenamed “monet,” finally went live in Android 12 Beta 2. The theming system creates color palettes based on the dominant color scheme of your wallpaper and applies them to Quick Settings tiles, lockscreen, Settings, pop-ups, and apps. However, in its current implementation, it only themes part of the system UI and select system apps. Most third-party apps don’t support this dynamic theming as Google hasn’t published the documentation on Material You yet. While we don’t know when Google will publish resources and libraries on Material You, Danny Lin (kdrag0n), the developer of ProtonAOSP ROM, has come forth with his own theme engine based on “monet”.
kdrag0n’s theming engine works just like “monet” and opens up the Pixel-exclusive dynamic theming to all devices running Android 12 and some older Android versions. kdrag0n was the developer that first got “monet” working in early Android 12 developer preview builds. Since then, he has reverse-engineered Google’s implementation and has even been giving feedback to members of Google’s SystemUI team, notably James O’Leary (who seems to be part of the team that developed “monet” at Google).
According to kdrag0n, his implementation doesn’t use any code or APIs from Google or Android 12, so there’s no dependency on devices running Android 12 for his model to be used. kdrag0n’s theme engine follows Material You color targets. These targets are then “recolored by adjusting colorfulness and hue in @bjornornorn’s Oklab perceptual color space. The resulting colors are gamut-mapped to sRGB using gamut intersection in Oklab space.” Users can also change colorfulness and make it prioritize colorfulness over accurate shades.
kdrag0n’s theme engine is open-source under the MIT license, allowing custom ROM developers (and even OEMs) to implement it if they wish to do so. In fact, the developer’s own ProtonAOSP ROM will be one of the first to implement it when the Android 12 source code is published. If you’re a custom ROM developer, you can cherry-pick these commits and merge them into your build.
The developer is also working on Jetpack Compose and Flutter libraries, which will allow even apps built for Android 11 to support dynamic colors. Apps targeting older Android versions can register a listener to get notified when wallpaper colors change — kdrag0n’s code is meant more for generating themes based on the new wallpaper color.
As an example of his model working for apps targeting Android 11, the developer shared a video with us demonstrating an app changing its theme every frame at 90fps. Do note that this demo is just an example of what can be done and is not recommended to be recreated exactly as shown.
This one can have a big hit on performance and battery, though the developer’s Pixel 4 can render theme changes at 90fps for simpler views. According to the developer, Jetpack Compose hasn’t been optimized for performance that much, and the Flutter library might be better. In any case, it only takes 0.05 ms for his engine to generate a theme, but changing the UI theme every frame is taxing on performance nonetheless.
Mishaal Rahman contributed to this article.