Skip to content

🎨 Jetpack Compose material theming library, which falls back onto a custom dynamic colors implementation based on wallpapers to support older API levels.

License

Notifications You must be signed in to change notification settings

T8RIN/DynamicTheme

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

21 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

DynamicTheme

material API Kotlin Jetpack Compose Hits

🎨 Jetpack Compose material theming library, which falls back onto a custom dynamic colors implementation based on wallpapers to support older API levels. Yes! Dynamic colors are now available even on old android devices, enjoy!

Examples (See ImageResizer)

material API Kotlin

Attention: ColorPicker not included in the package

Features

  • Declaring custom color scheme based on up to three colors
  • Content based colorscheme by providing bitmap
  • Dynamic themeing from android 5
  • Amoled mode support
  • Flexible api to retrieve secondary and tertiary colors from given primary color
  • Animating color scheme changes

πŸ”₯πŸ”₯πŸ”₯πŸ”₯πŸ”₯πŸ”₯πŸ”₯πŸ”₯πŸ”₯πŸ”₯πŸ”₯πŸ”₯πŸ”₯πŸ”₯

Usage

1. Add dependencies

latestVersion

Kotlin (kts)

repositories {
  maven { setUrl("https://jitpack.io") } // Add jitpack
}
dependencies {
  implementation("com.github.t8rin:dynamictheme:LATEST_VERSION") // Replace "LATEST_VERSION" with preferrend version tag
}

Groovy

repositories {
  maven { url 'https://jitpack.io' } // Add jitpack
}
dependencies {
  implementation 'com.github.t8rin:dynamictheme:LATEST_VERSION' // Replace "LATEST_VERSION" with preferrend version tag
}

2. Add DynamicTheme call

@Composable
fun DynamicThemeComposable() {

    DynamicTheme(
        state = rememberDynamicThemeState(),
        defaultColorTuple = ColorTuple(
            primary = /*your value*/,
            secondary = /*your value (optional)*/,
            tertiary = /*your value (optional)*/
        ),
        content = {
            /*your content
            * there you can get you provided state value by LocalDynamicThemeState.current
            */
        }
    )
    
    //...
    // Also you can use ColorTupleItem to get represenation of your color scheme by three colors

Roadmap

  • Rewrite to Kotlin

Find this repository useful? ❀️

Support it by joining stargazers for this repository. ⭐
And follow me for my next creations! 🀩

License

Designed and developed by 2023 T8RIN

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.