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

SwitchConstants

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

Contains the default values used by Switch

Summary

Public methods
SwitchColors
defaultColors(checkedThumbColor: Color = MaterialTheme.colors.secondaryVariant, checkedTrackColor: Color = checkedThumbColor, checkedTrackAlpha: Float = 0.54f, uncheckedThumbColor: Color = MaterialTheme.colors.surface, uncheckedTrackColor: Color = MaterialTheme.colors.onSurface, uncheckedTrackAlpha: Float = 0.38f, disabledCheckedThumbColor: Color = checkedThumbColor .copy(alpha = ContentAlpha.disabled) .compositeOver(MaterialTheme.colors.surface), disabledCheckedTrackColor: Color = checkedTrackColor .copy(alpha = ContentAlpha.disabled) .compositeOver(MaterialTheme.colors.surface), disabledUncheckedThumbColor: Color = uncheckedThumbColor .copy(alpha = ContentAlpha.disabled) .compositeOver(MaterialTheme.colors.surface), disabledUncheckedTrackColor: Color = uncheckedTrackColor .copy(alpha = ContentAlpha.disabled) .compositeOver(MaterialTheme.colors.surface))

Creates a SwitchColors that represents the different colors used in a Switch in different states.

Public methods

defaultColors

@Composable fun defaultColors(
    checkedThumbColor: Color = MaterialTheme.colors.secondaryVariant,
    checkedTrackColor: Color = checkedThumbColor,
    checkedTrackAlpha: Float = 0.54f,
    uncheckedThumbColor: Color = MaterialTheme.colors.surface,
    uncheckedTrackColor: Color = MaterialTheme.colors.onSurface,
    uncheckedTrackAlpha: Float = 0.38f,
    disabledCheckedThumbColor: Color = checkedThumbColor .copy(alpha = ContentAlpha.disabled) .compositeOver(MaterialTheme.colors.surface),
    disabledCheckedTrackColor: Color = checkedTrackColor .copy(alpha = ContentAlpha.disabled) .compositeOver(MaterialTheme.colors.surface),
    disabledUncheckedThumbColor: Color = uncheckedThumbColor .copy(alpha = ContentAlpha.disabled) .compositeOver(MaterialTheme.colors.surface),
    disabledUncheckedTrackColor: Color = uncheckedTrackColor .copy(alpha = ContentAlpha.disabled) .compositeOver(MaterialTheme.colors.surface)
): SwitchColors

Creates a SwitchColors that represents the different colors used in a Switch in different states.

Parameters
checkedThumbColor: Color = MaterialTheme.colors.secondaryVariant the color used for the thumb when enabled and checked
checkedTrackColor: Color = checkedThumbColor the color used for the track when enabled and checked
checkedTrackAlpha: Float = 0.54f the alpha applied to checkedTrackColor and disabledCheckedTrackColor
uncheckedThumbColor: Color = MaterialTheme.colors.surface the color used for the thumb when enabled and unchecked
uncheckedTrackColor: Color = MaterialTheme.colors.onSurface the color used for the track when enabled and unchecked
uncheckedTrackAlpha: Float = 0.38f the alpha applied to uncheckedTrackColor and disabledUncheckedTrackColor
disabledCheckedThumbColor: Color = checkedThumbColor .copy(alpha = ContentAlpha.disabled) .compositeOver(MaterialTheme.colors.surface) the color used for the thumb when disabled and checked
disabledCheckedTrackColor: Color = checkedTrackColor .copy(alpha = ContentAlpha.disabled) .compositeOver(MaterialTheme.colors.surface) the color used for the track when disabled and checked
disabledUncheckedThumbColor: Color = uncheckedThumbColor .copy(alpha = ContentAlpha.disabled) .compositeOver(MaterialTheme.colors.surface) the color used for the thumb when disabled and unchecked
disabledUncheckedTrackColor: Color = uncheckedTrackColor .copy(alpha = ContentAlpha.disabled) .compositeOver(MaterialTheme.colors.surface) the color used for the track when disabled and unchecked