commonMain.io.github.lyxnx.compose.pine.SnackbarDefaults.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pine Show documentation
Show all versions of pine Show documentation
Jetpack Compose Pine Theme
package io.github.lyxnx.compose.pine
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Shape
/**
* Contains the default values used by a [Snackbar]
*/
public object SnackbarDefaults {
/**
* The default shape used by a [Snackbar]
*/
public val Shape: Shape
@Composable get() = PineTheme.shapes.small
/**
* Creates a [SnackbarColors] instance for the given [type]
*/
@Composable
public fun snackbarColors(type: SnackbarType): SnackbarColors = when (type) {
SnackbarType.Success -> SnackbarColors(
containerColor = PineTheme.colors.success100,
messageColor = PineTheme.colors.success900,
actionColor = PineTheme.colors.primary500,
dismissActionColor = PineTheme.colors.primary500
)
SnackbarType.Warning -> SnackbarColors(
containerColor = PineTheme.colors.warning100,
messageColor = PineTheme.colors.warning900,
actionColor = PineTheme.colors.primary500,
dismissActionColor = PineTheme.colors.primary500
)
SnackbarType.Error -> SnackbarColors(
containerColor = PineTheme.colors.error100,
messageColor = PineTheme.colors.error900,
actionColor = PineTheme.colors.primary500,
dismissActionColor = PineTheme.colors.primary500
)
SnackbarType.Info -> SnackbarColors(
containerColor = PineTheme.colors.info100,
messageColor = PineTheme.colors.info900,
actionColor = PineTheme.colors.primary500,
dismissActionColor = PineTheme.colors.primary500
)
SnackbarType.Default -> SnackbarColors(
containerColor = PineTheme.colors.grey100,
messageColor = PineTheme.colors.grey900,
actionColor = PineTheme.colors.primary500,
dismissActionColor = PineTheme.colors.primary500
)
}
/**
* Creates a [SnackbarColors] instance with the given colors
*/
@Composable
public fun snackbarColors(
containerColor: Color = PineTheme.colors.grey100,
messageColor: Color = PineTheme.colors.grey900,
actionColor: Color = PineTheme.colors.primary500,
dismissActionColor: Color = PineTheme.colors.primary500
): SnackbarColors = SnackbarColors(
containerColor = containerColor,
messageColor = messageColor,
actionColor = actionColor,
dismissActionColor = dismissActionColor
)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy