I want to custom the color of IconButton instead of using the default value set on TopAppBar, but in android.compose.material there is no slot api to change it.
Scaffold(
topBar = {
TopAppBar(
title = {
Text(text = "LayoutsCodelab")
},
actions = {
IconButton(onClick = { /* doSomething() */ }) { // <- why it has the theme color and how to custom it.
Icon(Icons.Filled.Favorite)
}
}
)
}
)
You can use the tint
parameter in the Icon
composable:
actions = {
IconButton(onClick = { /* doSomething() */ }) {
Icon(Icons.Filled.Add,
"contentDescription",
tint = Color.Red)
}
}