public object ChipDefaults
Contains the default values used by Chip
Functions
primaryChipColors
@Composable
public fun primaryChipColors(
backgroundColor: Color = MaterialTheme.colors.primary,
contentColor: Color = contentColorFor(backgroundColor),
secondaryContentColor: Color = contentColor,
iconColor: Color = contentColor,
): ChipColors
Creates a ChipColors that represents the default background and content colors for a primary Chip. Primary chips have a colored background with a contrasting content color. If a chip is disabled then the colors will have an alpha(ContentAlpha.disabled) value applied.
Parameters
| backgroundColor | The background color of this Chip when enabled |
| contentColor | The content color of this Chip when enabled |
| secondaryContentColor | The secondary content color of this Chip when enabled, used for secondaryLabel content |
| iconColor | The icon color of this Chip when enabled, used for icon content |
gradientBackgroundChipColors
@Composable
public fun gradientBackgroundChipColors(
startBackgroundColor: Color =
MaterialTheme.colors.primary
.copy(alpha = 0.5f)
.compositeOver(MaterialTheme.colors.surface),
endBackgroundColor: Color =
MaterialTheme.colors.surface
.copy(alpha = 0f)
.compositeOver(MaterialTheme.colors.surface),
contentColor: Color = contentColorFor(endBackgroundColor),
secondaryContentColor: Color = contentColor,
iconColor: Color = contentColor,
gradientDirection: LayoutDirection = LocalLayoutDirection.current,
): ChipColors
Creates a ChipColors that represents the background and content colors for a primary Chip with a linear gradient for a background. The gradient will be between startBackgroundColor and endBackgroundColor. Gradient backgrounds are typically used for chips showing an on-going activity, such as a music track that is playing.
Gradient background chips should have a content color that contrasts with the background gradient. If a chip is disabled then the colors will have an alpha(ContentAlpha.disabled) value applied.
Parameters
| startBackgroundColor | The background color used at the start of the gradient of this Chip when enabled |
| endBackgroundColor | The background color used at the end of the gradient of this Chip when enabled |
| contentColor | The content color of this Chip when enabled |
| secondaryContentColor | The secondary content color of this Chip when enabled, used for secondaryLabel content |
| iconColor | The icon color of this Chip when enabled, used for icon content |
| gradientDirection | Whether the chips gradient should be start to end (indicated by LayoutDirection.Ltr) or end to start (indicated by LayoutDirection.Rtl). |
secondaryChipColors
@Composable
public fun secondaryChipColors(
backgroundColor: Color = MaterialTheme.colors.surface,
contentColor: Color = contentColorFor(backgroundColor),
secondaryContentColor: Color = contentColor,
iconColor: Color = contentColor,
): ChipColors
Creates a ChipColors that represents the default background and content colors for a secondary Chip. Secondary chips have a muted background with a contrasting content color. If a chip is disabled then the colors will have an alpha(ContentAlpha.disabled) value applied.
Parameters
| backgroundColor | The background color of this Chip when enabled |
| contentColor | The content color of this Chip when enabled |
| secondaryContentColor | The secondary content color of this Chip when enabled, used for secondaryLabel content |
| iconColor | The icon color of this Chip when enabled, used for icon content |
childChipColors
@Composable
public fun childChipColors(
contentColor: Color = MaterialTheme.colors.onSurface,
secondaryContentColor: Color = contentColor,
iconColor: Color = contentColor,
): ChipColors
Creates a ChipColors that represents the default background (transparent) and content colors for a child Chip. Child chips have a transparent background and use a default content color of Colors.onSurface.
If a chip is disabled then the colors will have an alpha(ContentAlpha.disabled) value applied.
Parameters
| contentColor | The content color of this Chip when enabled |
| secondaryContentColor | The secondary content color of this Chip when enabled, used for secondaryLabel content |
| iconColor | The icon color of this Chip when enabled, used for icon content |
imageBackgroundChipColors
@Composable
public fun imageBackgroundChipColors(
backgroundImagePainter: Painter,
backgroundImageScrimBrush: Brush =
Brush.linearGradient(
colors =
listOf(
MaterialTheme.colors.surface.copy(alpha = 1.0f),
MaterialTheme.colors.surface.copy(alpha = 0f),
)
),
contentColor: Color = MaterialTheme.colors.onBackground,
secondaryContentColor: Color = contentColor,
iconColor: Color = contentColor,
): ChipColors
Creates a ChipColors for an image background Chip. Image background chips have an image as the background of the chip typically with a scrim over the image to ensure that the content is visible, and use a default content color of Colors.onBackground.
Parameters
| backgroundImagePainter | The Painter to use to draw the background of the Chip |
| backgroundImageScrimBrush | The Brush to use to paint a scrim over the background image to ensure that any text drawn over the image is legible |
| contentColor | The content color of this Chip when enabled |
| secondaryContentColor | The secondary content color of this Chip when enabled, used for secondaryLabel content |
| iconColor | The icon color of this Chip when enabled, used for icon content |
outlinedChipColors
@Composable
public fun outlinedChipColors(
contentColor: Color = MaterialTheme.colors.primary,
secondaryContentColor: Color = contentColor,
iconColor: Color = contentColor,
): ChipColors
Creates a ChipColors for an outline Chip. Outline chips have a transparent background with a thin border.
If a chip is disabled then the colors will have an alpha(ContentAlpha.disabled) value applied.
Parameters
| contentColor | The content color of this Chip when enabled |
| secondaryContentColor | The secondary content color of this Chip when enabled, used for secondaryLabel content |
| iconColor | The icon color of this Chip when enabled, used for icon content |
chipBorder
@Composable
public fun chipBorder(
borderStroke: BorderStroke? = null,
disabledBorderStroke: BorderStroke? = null,
): ChipBorder
Creates a default (no border) ChipBorder for a Chip
Parameters
| borderStroke | The border for this Chip when enabled |
| disabledBorderStroke | The border to use for this Chip when disabled |
outlinedChipBorder
@Composable
public fun outlinedChipBorder(
borderColor: Color = MaterialTheme.colors.primaryVariant.copy(alpha = 0.6f),
disabledBorderColor: Color = borderColor.copy(alpha = ContentAlpha.disabled),
borderWidth: Dp = 1.dp,
): ChipBorder
Creates a ChipBorder for an OutlinedChip
Parameters
| borderColor | The color to use for the border for this OutlinedChip when enabled |
| disabledBorderColor | The color to use for the border for this OutlinedChip when disabled |
| borderWidth | The width to use for the border for this OutlinedChip |
chipColors
@Composable
public fun chipColors(
backgroundColor: Color = MaterialTheme.colors.primary,
contentColor: Color = contentColorFor(backgroundColor),
secondaryContentColor: Color = contentColor,
iconColor: Color = contentColor,
disabledBackgroundColor: Color = backgroundColor.copy(alpha = ContentAlpha.disabled),
disabledContentColor: Color = contentColor.copy(alpha = ContentAlpha.disabled),
disabledSecondaryContentColor: Color =
secondaryContentColor.copy(alpha = ContentAlpha.disabled),
disabledIconColor: Color = iconColor.copy(alpha = ContentAlpha.disabled),
): ChipColors
Creates a ChipColors that represents the default background and content colors used in a Chip.
Parameters
| backgroundColor | The background color of this Chip when enabled |
| contentColor | The content color of this Chip when enabled |
| secondaryContentColor | The content color of this Chip when enabled |
| iconColor | The content color of this Chip when enabled |
| disabledBackgroundColor | The background color of this Chip when not enabled |
| disabledContentColor | The content color of this Chip when not enabled |
| disabledSecondaryContentColor | The content color of this Chip when not enabled |
| disabledIconColor | The content color of this Chip when not enabled |
chipColors
@ExperimentalWearMaterialApi
public fun chipColors(
backgroundPainter: Painter,
contentColor: Color,
secondaryContentColor: Color,
iconColor: Color,
disabledBackgroundPainter: Painter,
disabledContentColor: Color,
disabledSecondaryContentColor: Color,
disabledIconColor: Color,
): ChipColors
Creates a ChipColors where all of the values are explicitly defined.
Parameters
| backgroundPainter | The background painter of this Chip when enabled |
| contentColor | The content color of this Chip when enabled |
| secondaryContentColor | The content color of this Chip when enabled |
| iconColor | The content color of this Chip when enabled |
| disabledBackgroundPainter | The background painter of this Chip when not enabled |
| disabledContentColor | The content color of this Chip when not enabled |
| disabledSecondaryContentColor | The content color of this Chip when not enabled |
| disabledIconColor | The content color of this Chip when not enabled |