Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 14 days ago
JSON representation
Backward compatibility support for Material You for Jetpack Compose
- Host: GitHub
- URL: https://github.com/re-ovo/md3compat
- Owner: re-ovo
- Created: 2022-04-22T12:13:08.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-01-29T03:00:04.000Z (almost 2 years ago)
- Last Synced: 2024-08-01T19:42:39.815Z (3 months ago)
- Topics: jetpack-compose, material-design, material-you, material3
- Language: Java
- Homepage:
- Size: 237 KB
- Stars: 13
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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()`