The Case of the Vanishing Text: Why Your Jetpack Compose UI is Gaslighting You

This title could be clearer and more informative.Try out Clickbait Shieldfor free (5 uses left this month).

A deep dive into a subtle but frustrating Jetpack Compose bug where UI elements become invisible due to a mismatch between static custom brand colors and Material 3's dynamic color system. When a static background color (like a custom dark green) is paired with a dynamic `onPrimary` or `onSurface` color calculated against a completely different base color, the result is near-zero contrast — text and icons disappear. Two real-world case studies illustrate how this passes QA in light mode but breaks in dark mode, or only affects users with Material You wallpaper overrides on Pixel devices. The correct fix is to define explicit contrasting color pairs for every custom brand color using `AppExtraColors` and `CompositionLocalProvider`, mirroring how Material 3 manages its own color pairs.

5m read timeFrom proandroiddev.com
Post cover image

Sort: