A flexible theme provider for Jetpack Compose. Supports dynamic theme changes and saving theme preference.

Overview

JetTheme

JetTheme is a flexible theme provider for Jetpack Compose.

  • Change the theme and recompose the UI dynamically.
  • Save theme preference to local storage.
  • Build your own design system.

Download

dependencies {
  // Use this if you want material design support (recommended)
  implementation "dev.lcdsmao.jettheme:jettheme-material:$latestVersion"
  // Use this if you want to build custom design system
  implementation "dev.lcdsmao.jettheme:jettheme:$latestVersion"
}

Quick Start

Provide Themes

Define your material themes themes using buildMaterialThemePack.

val AppTheme = buildMaterialThemePack {
  defaultMaterialTheme(
    colors = lightColors(...),
    typography = Typography(...),
    shapes = Shapes(...),
  )
  materialTheme(
    id = darkId,
    colors = darkColors(...),
  )
  materialTheme(
    id = "other_theme",
    colors = otherColors(...),
  )
}

For child components can correctly access defined AppTheme via MaterialTheme, wrap your child components in a ProvideAppMaterialTheme.

@Composable
fun App() {
  ProvideAppMaterialTheme(AppTheme) {
    // children
  }
}

Change Themes

You can retrieve current component tree's ThemeController from ThemeControllerAmbient.

val themeController = ThemeControllerAmbient.current

To change current theme you can use the theme id strings.

themeController.setThemeId(ThemeIds.Default)
themeController.setThemeId("other_theme_id")

Access Current Theme Values

You can access current theme values via MaterialTheme object (from androidx.compose.material):

Surface(color = MaterialTheme.colors.primary) {
  // children
}

Check out JetTheme's full documentation here.

Contributing

Feel free to open a issue or submit a pull request for any bugs/improvements.

Comments
  • build: bump deps

    build: bump deps

    🚀 Description

    📄 Motivation and Context

    🧪 How Has This Been Tested?

    📷 Screenshots (if appropriate)

    📦 Types of changes

    • [ ] Bug fix (non-breaking change which fixes an issue)
    • [ ] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

    ✅ Checklist

    • [ ] My code follows the code style of this project.
    • [ ] My change requires a change to the documentation.
    • [ ] I have updated the documentation accordingly.
    opened by lcdsmao 0
  • Remove bintray plugin

    Remove bintray plugin

    🚀 Description

    📄 Motivation and Context

    🧪 How Has This Been Tested?

    📷 Screenshots (if appropriate)

    📦 Types of changes

    • [ ] Bug fix (non-breaking change which fixes an issue)
    • [ ] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

    ✅ Checklist

    • [ ] My code follows the code style of this project.
    • [ ] My change requires a change to the documentation.
    • [ ] I have updated the documentation accordingly.
    opened by lcdsmao 0
  • Bump compose, dataStore

    Bump compose, dataStore

    🚀 Description

    📄 Motivation and Context

    🧪 How Has This Been Tested?

    📷 Screenshots (if appropriate)

    📦 Types of changes

    • [ ] Bug fix (non-breaking change which fixes an issue)
    • [ ] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

    ✅ Checklist

    • [ ] My code follows the code style of this project.
    • [ ] My change requires a change to the documentation.
    • [ ] I have updated the documentation accordingly.
    opened by lcdsmao 0
  • ThemeSpec generic parameter

    ThemeSpec generic parameter

    🚀 Description

    Use ThemeSpec generic as parameter as possible

    📄 Motivation and Context

    🧪 How Has This Been Tested?

    📷 Screenshots (if appropriate)

    📦 Types of changes

    • [ ] Bug fix (non-breaking change which fixes an issue)
    • [ ] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

    ✅ Checklist

    • [ ] My code follows the code style of this project.
    • [ ] My change requires a change to the documentation.
    • [ ] I have updated the documentation accordingly.
    opened by lcdsmao 0
  • Remove crossfade in provider

    Remove crossfade in provider

    🚀 Description

    Animation should be controlled by the user itself.

    📄 Motivation and Context

    🧪 How Has This Been Tested?

    📷 Screenshots (if appropriate)

    📦 Types of changes

    • [ ] Bug fix (non-breaking change which fixes an issue)
    • [ ] New feature (non-breaking change which adds functionality)
    • [x] Breaking change (fix or feature that would cause existing functionality to not work as expected)

    ✅ Checklist

    • [ ] My code follows the code style of this project.
    • [ ] My change requires a change to the documentation.
    • [ ] I have updated the documentation accordingly.
    opened by lcdsmao 0
  • Remove ThemeControllerAmbient

    Remove ThemeControllerAmbient

    🚀 Description

    📄 Motivation and Context

    🧪 How Has This Been Tested?

    📷 Screenshots (if appropriate)

    📦 Types of changes

    • [ ] Bug fix (non-breaking change which fixes an issue)
    • [ ] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

    ✅ Checklist

    • [ ] My code follows the code style of this project.
    • [ ] My change requires a change to the documentation.
    • [ ] I have updated the documentation accordingly.
    opened by lcdsmao 0
  • bump version

    bump version

    🚀 Description

    • AGP to 7.0.0-alpha03
    • Kotlin to 1.4.21
    • Compose to 1.0.0-alpha09
    • Kotest to 4.3.2

    📄 Motivation and Context

    🧪 How Has This Been Tested?

    📷 Screenshots (if appropriate)

    📦 Types of changes

    • [ ] Bug fix (non-breaking change which fixes an issue)
    • [ ] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

    ✅ Checklist

    • [ ] My code follows the code style of this project.
    • [ ] My change requires a change to the documentation.
    • [ ] I have updated the documentation accordingly.
    opened by lcdsmao 0
  • Restore sleepAndWait

    Restore sleepAndWait

    🚀 Description

    📄 Motivation and Context

    🧪 How Has This Been Tested?

    📷 Screenshots (if appropriate)

    📦 Types of changes

    • [ ] Bug fix (non-breaking change which fixes an issue)
    • [ ] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

    ✅ Checklist

    • [ ] My code follows the code style of this project.
    • [ ] My change requires a change to the documentation.
    • [ ] I have updated the documentation accordingly.
    opened by lcdsmao 0
  • Android Gradle 7.0.0-alpha02

    Android Gradle 7.0.0-alpha02

    • Gradle Plugin 7.0.0-alpha02
    • Refactor precompiled scripts
    • Disable test when there is no test source file
      • Related issue: https://issuetracker.google.com/issues/174839536
    opened by lcdsmao 0
  • Features: Weekly refresh versions

    Features: Weekly refresh versions

    🚀 Description

    Add Weekly refresh versions workflow

    📄 Motivation and Context

    Check new dependencies weekly

    🧪 How Has This Been Tested?

    NO

    📷 Screenshots (if appropriate)

    NO

    📦 Types of changes

    • [ ] Bug fix (non-breaking change which fixes an issue)
    • [x] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

    ✅ Checklist

    • [x] My code follows the code style of this project.
    • [x] My change requires a change to the documentation.
    • [x] I have updated the documentation accordingly.
    opened by lcdsmao 0
  • Feature: Bump datastore to 1.0.0-alpha04

    Feature: Bump datastore to 1.0.0-alpha04

    🚀 Description

    • Bump DataStore to 1.0.0-alpha04
    • Remove artifactory plugin resolve field (error occur when executing refreshVersions)

    📄 Motivation and Context

    Bump dependencies version

    🧪 How Has This Been Tested?

    Yes

    📦 Types of changes

    • [ ] Bug fix (non-breaking change which fixes an issue)
    • [x] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

    ✅ Checklist

    • [x] My code follows the code style of this project.
    • [x] My change requires a change to the documentation.
    • [x] I have updated the documentation accordingly.
    opened by lcdsmao 0
Common preference/settings Composables for Jetpack Compose.

ComposePrefs ComposePrefs is a preferences library for Jetpack Compose which makes it easy to implement preferences/settings in your Compose Android a

Jamal Mulla 54 Jan 5, 2023
ComposePrefs3 is a fully featured library of preference composables for Jetpack Compose.

ComposePrefs3 This is the M3 version of ComposePrefs. The M2 version can be found here. ComposePrefs3 is a preferences library for Jetpack Compose whi

Jamal Mulla 21 Dec 2, 2022
Dynamic Badge with customizable features as max number before displaying with +, color, shadow, border, corner radius, font properties and more written with Jetpack Compose

✏️?? Dynamic Badge with customizable features as max number before displaying with +, color, shadow, border, corner radius, font properties and more written with Jetpack Compose. Displays numbers either in circle or rounded rectangle shape based on badge count and selected threshold to transform from circle to rounded rectangle.

Smart Tool Factory 4 Jul 27, 2022
Undo snapshot state changes in Compose.

compose-undo Track changes to any snapshot state object and restore state from any point in the past. Usage implementation 'com.zachklipp.compose-undo

Zach Klippenstein 135 Jan 1, 2023
🚀📱💖Animated LazyColumn/Row changes scale/color with animation and have a current selected item like a Pager. An elegant alternative for selecting from a list

Compose AnimatedList Animated infinite and finite LazyRow and LazyColumn with scale and color animations on scroll change based on how far they are to

Smart Tool Factory 47 Nov 16, 2022
Resume of Louis CAD, made with Jetpack Compose. Supports the Web, Desktop, and Android.

ResumeComposition What This project is the source code of the resume/CV of Louis CAD. The latest PDF export is available here, it is ready to print. H

Louis CAD 22 Aug 14, 2022
Flux is a dynamic weather that communicates the weather throughout a landscape whose details vary according to the time and the weather at that particular time.

Flux ?? Description Flux is a dynamic weather that communicates the weather throughout a landscape whose details vary according to the time and the we

null 415 Jan 4, 2023
A Jetpack Compose Note writing application with Windows 97 theme

Compose-windows97 A Jetpack Compose Note writing application with Windows 97 theme Inspiration Recent tweet from Marton Braun and Website 98.js Hangin

Chetan Gupta 24 Dec 12, 2022
Simple example how you can use dynamic color image vector in your app.

Dynamic Color ImageVector Simple example how you can use dynamic color image vector in your app. How to use 1. Create a xml image vector The content o

Lucas Martins 1 Oct 28, 2022
Flexible Chat Row and Resizable SubcomposeLayout

Flexible chat row written with Jetpack Compose that positions message and message status based on number of message lines, message width and parent width. And resizeble Sucomposelayout that remasures sibling composables to match their widths' to longest composable. This is for matching quote and message width to each other.

Smart Tool Factory 21 Jan 1, 2023
A simple authentication application using Jetpack compose to illustrate signin and sign up using Mvvm, Kotlin and jetpack compose

Authentication A simple authentication application using Jetpack compose to illustrate signin and sign up using Mvvm, Kotlin and jetpack compose Scree

Felix Kariuki 5 Dec 29, 2022
🔥 Supports AndroidX and Android-Support

RePluginX 本 Repo 是对 Qihoo360 RePlugin 的完善、增强。 Q: 为什么有这个 Repo? A: 因工作项目需要 使用 & 定制,但官方已经很久没有维护(难道是太稳定了?),且 issue 也没有怎么处理,提交官方 pr 怕是要等到天荒地老,时间紧、任务重,我还是自己

LinQiaRui 39 Dec 8, 2022
Compose-navigation - Set of utils to help with integrating Jetpack Compose and Jetpack's Navigation

Jetpack Compose Navigation Set of utils to help with integrating Jetpack Compose

Adam Kobus 5 Apr 5, 2022
Jetpack Compose Boids | Flocking Insect 🐜. bird or Fish simulation using Jetpack Compose Desktop 🚀, using Canvas API 🎨

?? ?? ?? Compose flocking Ants(boids) ?? ?? ?? Jetpack compose Boids | Flocking Insect. bird or Fish simulation using Jetpack Compose Desktop ?? , usi

Chetan Gupta 38 Sep 25, 2022
A collection of animations, compositions, UIs using Jetpack Compose. You can say Jetpack Compose cookbook or play-ground if you want!

Why Not Compose! A collection of animations, compositions, UIs using Jetpack Compose. You can say Jetpack Compose cookbook or play-ground if you want!

Md. Mahmudul Hasan Shohag 186 Jan 1, 2023
Learn Jetpack Compose for Android by Examples. Learn how to use Jetpack Compose for Android App Development. Android’s modern toolkit for building native UI.

Learn Jetpack Compose for Android by Examples. Learn how to use Jetpack Compose for Android App Development. Android’s modern toolkit for building native UI.

MindOrks 382 Jan 5, 2023
This is a sample app(For beginners - App #2) built using Jetpack Compose. It demonstrates the concept of State Hoisting in Jetpack Compose.

JetBMICalculator This is a sample app(For beginners - App #2) built using Jetpack Compose. It demonstrates the concept of State Hoisting in Jetpack Co

BHAVNA THACKER 3 Dec 31, 2022
Jetpack-Compose-Demo - Instagram Profile UI using Jetpack Compose

Jetpack-Compose-Demo Instagram Profile UI using Jetpack Compose

omar 1 Aug 11, 2022
Jetpack-compose-animations-examples - Cool animations implemented with Jetpack compose

Jetpack-compose-animations-examples This repository consists of 4 animations: St

Canopas Software 180 Jan 2, 2023