Another question: I see there is MaterialTheme.err...
# compose
p
Another question: I see there is MaterialTheme.error. Is there such colors for success and warning? If there is no such values, how can I add them and make adoptive (for light, dark or custom theme)?
a
You can add them as extension methods/properties. If you plan to support more than light and dark, it may require more effort.
Take a look at this https://github.com/JetpackDuba/Gitnuro/blob/main/src/main/kotlin/com/jetpackduba/gitnuro/theme/Theme.kt#L15 It's compose for desktop but it should be identical for Android If you only have light & dark theme you may consider doing sth like this:
Copy code
val Colors.warning: Color
    get() {
        return if(isLight)
            colorWarningLight
        else
            colorWarningDark
    }
j
You can also do a CompositionLocal. I prefer it a touch more than putting extension functions on ColorScheme as it's more clear where the values are coming from. But either works. Just be aware when using Compose Desktop examples that Colors (M2) and ColorScheme(M3) are different.