我正在使用 jetpack compose 为我的应用程序制作一个主题,我有这个:
@Composable
fun MyTheme(content: @Composable () -> Unit) {
val colors = lightColors(
primary = CustomColors.Custom1,
primaryVariant = CustomColors.Custom2,
onPrimary = Color.White,
background = Color.White,
secondary = CustomColors.Custom2
)
MaterialTheme(colors = colors, content = content)
}
object CustomColors{
val Custom1 = Color(0xEF119335)
val Custom2= Color(0xAA892335)
}
Run Code Online (Sandbox Code Playgroud)
问题是,当我添加时secondary = CustomColors.Custom2,我收到错误onPrimary = Color.White。错误是这样的:
给定背景错误的“开启”颜色冲突