I am trying to learn how to set a custom application theme in Jetpack compose but I am struggling to set color of primaryVariant color that doesn't seem to be overridden when I create my custom color pallet.
private val MyLightColorPalette = lightColors(
primary = Green,
primaryVariant = Grey,
onPrimary = Color.White,
secondary = Green,
secondaryVariant = Grey,
onSecondary = Color.White,
error = DarkGrey,
)
This is my color pallet and yet it uses that purple color instead of green. Does somebody know why it still using the default purple color?
Here is the rest of the code:
@Composable
fun MyAppTheme(darkTheme: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit) {
val colors = if (darkTheme) {
MyDarkColorPalette
} else {
MyLightColorPalette
}
MaterialTheme(
colors = colors,
typography = Typography,
shapes = Shapes,
content = content
)
}
@AndroidEntryPoint
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
MyAppTheme {
Scaffold() {
TopBar()
}
}
}
}
}
Compose version that I am using is 1.0.4