# SnackbarDefaults

# SnackbarDefaults

Artifact:[androidx.compose.material:material](https://developer.android.com/jetpack/androidx/releases/compose-material)  
[View Source](https://cs.android.com/search?q=file:androidx/compose/material/Snackbar.kt+class:androidx.compose.material.SnackbarDefaults)  
Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-material#1.0.0)
Common/AllAndroid/JVM
  - Cmn  

  ```
  object SnackbarDefaults
  ```

*** ** * ** ***

Object to hold defaults used by[Snackbar](https://developer.android.com/reference/kotlin/androidx/compose/material/package-summary#Snackbar(androidx.compose.ui.Modifier,kotlin.Function0,kotlin.Boolean,androidx.compose.ui.graphics.Shape,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.unit.Dp,kotlin.Function0))

## Summary

|                                   ### Public properties                                    |
|--------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----|
| [Color](https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color) | [backgroundColor](https://developer.android.com/reference/kotlin/androidx/compose/material/SnackbarDefaults#backgroundColor()) Default background color of the[Snackbar](https://developer.android.com/reference/kotlin/androidx/compose/material/package-summary#Snackbar(androidx.compose.ui.Modifier,kotlin.Function0,kotlin.Boolean,androidx.compose.ui.graphics.Shape,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.unit.Dp,kotlin.Function0))                                                        | Cmn |
| [Color](https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color) | [primaryActionColor](https://developer.android.com/reference/kotlin/androidx/compose/material/SnackbarDefaults#primaryActionColor()) Provides a best-effort 'primary' color to be used as the primary color inside a[Snackbar](https://developer.android.com/reference/kotlin/androidx/compose/material/package-summary#Snackbar(androidx.compose.ui.Modifier,kotlin.Function0,kotlin.Boolean,androidx.compose.ui.graphics.Shape,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.unit.Dp,kotlin.Function0)). | Cmn |

## Public properties

### backgroundColor

Cmn  
Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-material#1.0.0)  

```
val backgroundColor: Color
```

Default background color of the[Snackbar](https://developer.android.com/reference/kotlin/androidx/compose/material/package-summary#Snackbar(androidx.compose.ui.Modifier,kotlin.Function0,kotlin.Boolean,androidx.compose.ui.graphics.Shape,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.unit.Dp,kotlin.Function0))  

### primaryActionColor

Cmn  
Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-material#1.0.0)  

```
val primaryActionColor: Color
```

Provides a best-effort 'primary' color to be used as the primary color inside a[Snackbar](https://developer.android.com/reference/kotlin/androidx/compose/material/package-summary#Snackbar(androidx.compose.ui.Modifier,kotlin.Function0,kotlin.Boolean,androidx.compose.ui.graphics.Shape,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.unit.Dp,kotlin.Function0)). Given that[Snackbar](https://developer.android.com/reference/kotlin/androidx/compose/material/package-summary#Snackbar(androidx.compose.ui.Modifier,kotlin.Function0,kotlin.Boolean,androidx.compose.ui.graphics.Shape,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.unit.Dp,kotlin.Function0))s 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](https://developer.android.com/reference/kotlin/androidx/compose/material/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](https://developer.android.com/reference/kotlin/androidx/compose/material/Colors#primary())from the dark theme when in a light theme, and use[Colors.primaryVariant](https://developer.android.com/reference/kotlin/androidx/compose/material/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](https://developer.android.com/reference/kotlin/androidx/compose/material/Colors#primary())from[MaterialTheme.colors](https://developer.android.com/reference/kotlin/androidx/compose/material/MaterialTheme#colors())to attempt to reduce the contrast, and when in a dark theme this function uses[Colors.primaryVariant](https://developer.android.com/reference/kotlin/androidx/compose/material/Colors#primaryVariant()).