Google is committed to advancing racial equity for Black communities. See how.

SnackbarConstants

object SnackbarConstants
kotlin.Any
   ↳ androidx.compose.material.SnackbarConstants

Object to hold constants used by the Snackbar

Summary

Properties
Color

Provides a best-effort 'primary' color to be used as the primary color inside a Snackbar.

Color

Default background color of the Snackbar

Properties

defaultActionPrimaryColor

@Composable val defaultActionPrimaryColor: Color

Provides a best-effort 'primary' color to be used as the primary color inside a Snackbar. Given that Snackbars have an 'inverted' theme, i.e in a light theme they appear dark, and in a dark theme they appear light, just using Colors.primary will not work, and has incorrect contrast.

If your light theme has a corresponding dark theme, you should instead directly use Colors.primary from the dark theme when in a light theme, and use Colors.primaryVariant from the dark theme when in a dark theme.

When in a light theme, this function applies a color overlay to Colors.primary from MaterialTheme.colors to attempt to reduce the contrast, and when in a dark theme this function uses Colors.primaryVariant.

defaultBackgroundColor

@Composable val defaultBackgroundColor: Color

Default background color of the Snackbar