Skip to content

Android

Android theming

Light, dark and high-contrast themes in Jetpack Compose with StanceTheme: system contrast detection, persistence, type scale and motion.

StanceTheme provides the active theme through StanceTheme.colors, typography, shapes, elevation, motion, spacing and sizes.

  • Three themes: light, dark and high contrast, from the same tokens as the web and iOS.
  • System follows the device. A request for more contrast wins over dark theme. The system contrast level is read on Android 14 and later, and the high contrast text setting on older versions.
  • The choice is saved in SharedPreferences under stance-theme, with the same values as the web.

Letting people choose

kotlin
var appearance by rememberStanceAppearance()

StanceTheme(appearance = appearance) {
    // StanceAppearance.System, Light, Dark or HighContrast
}

Reading the theme

kotlin
Text(
    text = "Deployed",
    color = StanceTheme.colors.fgMuted,
    style = StanceTheme.typography.body,
)

No dynamic colour

Material You dynamic colour is off on purpose. Binds has two brand colours, ivory and indigo, and every Stance theme is derived from them.

Typography and font scale

Type sizes are in sp, so text follows the system font size. The default typeface is the platform one. Pass a FontFamily to StanceTheme to use DM Sans.

Motion

Motion uses the Stance duration and easing tokens. When the system has animations turned off, StanceTheme.motion returns snap() specs.