CardColors

Class

Common
class CardColors
constructor(
    val containerColor: Color,
    val contentColor: Color,
    val disabledContainerColor: Color,
    val disabledContentColor: Color,
)

Represents the container and content colors used in a card in different states.

  • See CardDefaults.cardColors for the default colors used in a Card.
  • See CardDefaults.elevatedCardColors for the default colors used in a ElevatedCard.
  • See CardDefaults.outlinedCardColors for the default colors used in a OutlinedCard.

Parameters

containerColorthe container color of this Card when enabled.
contentColorthe content color of this Card when enabled.
disabledContainerColorthe container color of this Card when not enabled.
disabledContentColorthe content color of this Card when not enabled.

Functions

fun copy(
        containerColor: Color = this.containerColor,
        contentColor: Color = this.contentColor,
        disabledContainerColor: Color = this.disabledContainerColor,
        disabledContentColor: Color = this.disabledContentColor,
    ) =
        CardColors(
            containerColor.takeOrElse { this.containerColor },
            contentColor.takeOrElse { this.contentColor },
            disabledContainerColor.takeOrElse { this.disabledContainerColor },
            disabledContentColor.takeOrElse { this.disabledContentColor },
        )

Returns a copy of this CardColors, optionally overriding some of the values. This uses the Color.Unspecified to mean “use the value from the source”