# SwitchColors

# SwitchColors

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/Switch.kt+class:androidx.compose.material.SwitchColors)  
Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-material#1.0.0)
Common/AllAndroid/JVM
  - Cmn  

  ```
  interface SwitchColors
  ```

*** ** * ** ***

Represents the colors used by a[Switch](https://developer.android.com/reference/kotlin/androidx/compose/material/package-summary#Switch(kotlin.Boolean,kotlin.Function1,androidx.compose.ui.Modifier,kotlin.Boolean,androidx.compose.foundation.interaction.MutableInteractionSource,androidx.compose.material.SwitchColors))in different states

See[SwitchDefaults.colors](https://developer.android.com/reference/kotlin/androidx/compose/material/SwitchDefaults#colors(androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,kotlin.Float,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,kotlin.Float,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color))for the default implementation that follows Material specifications.

## Summary

|                                                                                  ### Public functions                                                                                  |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----|
| [State](https://developer.android.com/reference/kotlin/androidx/compose/runtime/State)`<`[Color](https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color)`>` | `@`[Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable) [thumbColor](https://developer.android.com/reference/kotlin/androidx/compose/material/SwitchColors#thumbColor(kotlin.Boolean,kotlin.Boolean))`(enabled: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`, checked: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`)` Represents the color used for the switch's thumb, depending on[enabled](https://developer.android.com/reference/kotlin/androidx/compose/material/SwitchColors#thumbColor(kotlin.Boolean,kotlin.Boolean))and[checked](https://developer.android.com/reference/kotlin/androidx/compose/material/SwitchColors#thumbColor(kotlin.Boolean,kotlin.Boolean)). | Cmn |
| [State](https://developer.android.com/reference/kotlin/androidx/compose/runtime/State)`<`[Color](https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color)`>` | `@`[Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable) [trackColor](https://developer.android.com/reference/kotlin/androidx/compose/material/SwitchColors#trackColor(kotlin.Boolean,kotlin.Boolean))`(enabled: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`, checked: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`)` Represents the color used for the switch's track, depending on[enabled](https://developer.android.com/reference/kotlin/androidx/compose/material/SwitchColors#trackColor(kotlin.Boolean,kotlin.Boolean))and[checked](https://developer.android.com/reference/kotlin/androidx/compose/material/SwitchColors#trackColor(kotlin.Boolean,kotlin.Boolean)). | Cmn |

## Public functions

### thumbColor

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

```
@Composable
fun thumbColor(enabled: Boolean, checked: Boolean): State<Color>
```

Represents the color used for the switch's thumb, depending on[enabled](https://developer.android.com/reference/kotlin/androidx/compose/material/SwitchColors#thumbColor(kotlin.Boolean,kotlin.Boolean))and[checked](https://developer.android.com/reference/kotlin/androidx/compose/material/SwitchColors#thumbColor(kotlin.Boolean,kotlin.Boolean)).  

|                                           Parameters                                           |
|------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `enabled: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | whether the[Switch](https://developer.android.com/reference/kotlin/androidx/compose/material/package-summary#Switch(kotlin.Boolean,kotlin.Function1,androidx.compose.ui.Modifier,kotlin.Boolean,androidx.compose.foundation.interaction.MutableInteractionSource,androidx.compose.material.SwitchColors))is enabled or not |
| `checked: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | whether the[Switch](https://developer.android.com/reference/kotlin/androidx/compose/material/package-summary#Switch(kotlin.Boolean,kotlin.Function1,androidx.compose.ui.Modifier,kotlin.Boolean,androidx.compose.foundation.interaction.MutableInteractionSource,androidx.compose.material.SwitchColors))is checked or not |

### trackColor

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

```
@Composable
fun trackColor(enabled: Boolean, checked: Boolean): State<Color>
```

Represents the color used for the switch's track, depending on[enabled](https://developer.android.com/reference/kotlin/androidx/compose/material/SwitchColors#trackColor(kotlin.Boolean,kotlin.Boolean))and[checked](https://developer.android.com/reference/kotlin/androidx/compose/material/SwitchColors#trackColor(kotlin.Boolean,kotlin.Boolean)).  

|                                           Parameters                                           |
|------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `enabled: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | whether the[Switch](https://developer.android.com/reference/kotlin/androidx/compose/material/package-summary#Switch(kotlin.Boolean,kotlin.Function1,androidx.compose.ui.Modifier,kotlin.Boolean,androidx.compose.foundation.interaction.MutableInteractionSource,androidx.compose.material.SwitchColors))is enabled or not |
| `checked: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | whether the[Switch](https://developer.android.com/reference/kotlin/androidx/compose/material/package-summary#Switch(kotlin.Boolean,kotlin.Function1,androidx.compose.ui.Modifier,kotlin.Boolean,androidx.compose.foundation.interaction.MutableInteractionSource,androidx.compose.material.SwitchColors))is checked or not |