Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/re-ovo/md3compat

Backward compatibility support for Material You for Jetpack Compose
https://github.com/re-ovo/md3compat

jetpack-compose material-design material-you material3

Last synced: about 2 months ago
JSON representation

Backward compatibility support for Material You for Jetpack Compose

Awesome Lists containing this project

README

        

# MD3Compat
Backward compatibility support for [Material You](https://m3.material.io) 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](https://github.com/material-foundation/material-color-utilities)

[中文说明在这里](README_CN.md)

## Screenshots
![](arts/screenshot.png)

## Import to your project
1. Add `jitpack.io` to repositories in `settings.gradle`
```groovy
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
...
maven {
url 'https://jitpack.io'
}
}
}
```

2. Add dependencies to `build.gradle` [![](https://jitpack.io/v/re-ovo/md3compat.svg)](https://jitpack.io/#re-ovo/md3compat)
```groovy
implementation 'com.github.re-ovo:md3compat:'
```

## Basic Usage (Low level API)
```kotlin
@Composable
fun BasicAPIExample() {
// Get all dynamic color schemes based on the wallpaper (Require Android 8.1+)
val dynamicColorScheme: List = dynamicColorScheme(isSystemInDarkTheme())

// Get all basic color schemes
val basicColorScheme: List = basicColorScheme(isSystemInDarkTheme())
}
```
## Advanced Usage
```kotlin
// Use this as your theme
Md3CompatTheme {
// Content
}

// Use this as a color picker
ThemeChooser()
```

> It was based on [compose-setting](https://github.com/re-ovo/compose-setting), so you might need to call `initComposeSetting()` in the `Application.onCreate()`