SystemBarStyle


class SystemBarStyle


The style for the status bar or the navigation bar used in enableEdgeToEdge.

Summary

Public companion functions

SystemBarStyle
auto(
    lightScrim: @ColorInt Int,
    darkScrim: @ColorInt Int,
    detectDarkMode: (Resources) -> Boolean
)

Creates a new instance of SystemBarStyle.

SystemBarStyle
dark(scrim: @ColorInt Int)

Creates a new instance of SystemBarStyle.

SystemBarStyle
light(scrim: @ColorInt Int, darkScrim: @ColorInt Int)

Creates a new instance of SystemBarStyle.

Public companion functions

auto

Added in 1.8.0
fun auto(
    lightScrim: @ColorInt Int,
    darkScrim: @ColorInt Int,
    detectDarkMode: (Resources) -> Boolean = { resources -> (resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES }
): SystemBarStyle

Creates a new instance of SystemBarStyle. This style detects the dark mode automatically and applies the recommended style for each of the status bar and the navigation bar. If this style doesn't work for your app, consider using either dark or light.

  • On API level 29 and above, both the status bar and the navigation bar will be transparent. However, the navigation bar with 3 or 2 buttons will have a translucent scrim. This scrim color is provided by the platform and cannot be customized.

  • On API level 28 and below, the status bar will be transparent, and the navigation bar will have one of the specified scrim colors depending on the dark mode.

Parameters
lightScrim: @ColorInt Int

The scrim color to be used for the background when the app is in light mode. Note that this is used only on API level 28 and below.

darkScrim: @ColorInt Int

The scrim color to be used for the background when the app is in dark mode. This is also used on devices where the system icon color is always light. Note that this is used only on API level 28 and below.

detectDarkMode: (Resources) -> Boolean = { resources -> (resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES }

Optional. Detects whether UI currently uses dark mode or not. The default implementation can detect any of the standard dark mode features from the platform, appcompat, and Jetpack Compose.

dark

Added in 1.8.0
fun dark(scrim: @ColorInt Int): SystemBarStyle

Creates a new instance of SystemBarStyle. This style consistently applies the specified scrim color regardless of the system navigation mode.

Parameters
scrim: @ColorInt Int

The scrim color to be used for the background. It is expected to be dark for the contrast against the light system icons.

light

Added in 1.8.0
fun light(scrim: @ColorInt Int, darkScrim: @ColorInt Int): SystemBarStyle

Creates a new instance of SystemBarStyle. This style consistently applies the specified scrim color regardless of the system navigation mode.

Parameters
scrim: @ColorInt Int

The scrim color to be used for the background. It is expected to be light for the contrast against the dark system icons.

darkScrim: @ColorInt Int

The scrim color to be used for the background on devices where the system icon color is always light. It is expected to be dark.