I'm creating a theme and set colors. I have differ...
# compose
j
I'm creating a theme and set colors. I have different colors for onSecondary, onBackground/onSurface. There is an error for conflicting 'on' color for background. I don't understand when onSecondary would conflict with these, and why they are different values. Can anyone help me understand if I'm doing something wrong here?
l
This error means that you have two 'background' colors which are the same, but different 'on' colors between them. Could you share the colors you have defined?
👍 1
j
Copy code
private val LightColors = lightColors(
    primary = Blue500,
    primaryVariant = Blue500,
    onPrimary = Color.White,
    secondary = Color.White,
    secondaryVariant = Color.White,
    onSecondary = N500,
    error = DarkRed,
    onError = Color.White,
    background = Color.White,
    onBackground = N900,
    surface = Color.White,
    onSurface = N900
l
Yep, so you have set both background and secondary to white, but onBackground and onSecondary are different. This means we can't disambiguate between them when calculating the correct onColor
So you should either make onBackground and onSecondary the same, or make background and secondary different
j
Ok this makes perfect sense, thanks for clearing that up!
Well changing the secondary color still gives the same error.
l
Did you change the secondary color to a color that is used by another 'background' color?
Or, maybe secondaryVariant is also causing this error
j
I changed it to a color that we don't' use anywhere
ah yeah that was it
if I change both the secondaryVariant and secondary the error disapears