Backward compatibility support for Material You for Jetpack Compose. Since Google currently only provides dynamic theme support for MaterialYou on Android 12+, but many users haven't upgraded to it, I made this library to provide MaterialYou support for Android 8.1 and above The project is based on material-color-utilities
- Add
jitpack.io
to repositories insettings.gradle
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
...
maven {
url 'https://jitpack.io'
}
}
}
implementation 'com.github.re-ovo:md3compat:<latest>'
@Composable
fun BasicAPIExample() {
// Get all dynamic color schemes based on the wallpaper (Require Android 8.1+)
val dynamicColorScheme: List<ColorScheme> = dynamicColorScheme(isSystemInDarkTheme())
// Get all basic color schemes
val basicColorScheme: List<ColorScheme> = basicColorScheme(isSystemInDarkTheme())
}
// Use this as your theme
Md3CompatTheme {
// Content
}
// Use this as a color picker
ThemeChooser()
It was based on compose-setting, so you might need to call
initComposeSetting()
in theApplication.onCreate()