{"id":13494226,"url":"https://github.com/prathameshmm02/ThemeEngine","last_synced_at":"2025-03-28T13:32:50.057Z","repository":{"id":43913011,"uuid":"484720663","full_name":"prathameshmm02/ThemeEngine","owner":"prathameshmm02","description":"Material Design 3 Theme Engine for Android","archived":false,"fork":false,"pushed_at":"2022-06-10T14:17:20.000Z","size":7049,"stargazers_count":64,"open_issues_count":1,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-08-01T19:49:20.138Z","etag":null,"topics":["android","android-library","kotlin","material-design","material-you","theme-switcher"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/prathameshmm02.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-04-23T10:52:08.000Z","updated_at":"2024-07-27T11:08:02.000Z","dependencies_parsed_at":"2022-09-05T15:41:28.448Z","dependency_job_id":null,"html_url":"https://github.com/prathameshmm02/ThemeEngine","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prathameshmm02%2FThemeEngine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prathameshmm02%2FThemeEngine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prathameshmm02%2FThemeEngine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prathameshmm02%2FThemeEngine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prathameshmm02","download_url":"https://codeload.github.com/prathameshmm02/ThemeEngine/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222382542,"owners_count":16975382,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","android-library","kotlin","material-design","material-you","theme-switcher"],"created_at":"2024-07-31T19:01:23.005Z","updated_at":"2024-10-31T08:32:08.588Z","avatar_url":"https://github.com/prathameshmm02.png","language":"Kotlin","funding_links":[],"categories":["Kotlin","💻 Developer \u0026 Power User"],"sub_categories":["🧩 Material Catalogs"],"readme":"# A Material Design 3 Theme Engine for Android\n[![Android CI](https://github.com/prathameshmm02/ThemeEngine/actions/workflows/android.yml/badge.svg)](https://github.com/prathameshmm02/ThemeEngine/actions/workflows/android.yml)\n[![Maven Central](https://img.shields.io/maven-central/v/io.github.prathameshmm02.themeEngine/themeEngine.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22io.github.prathameshmm02.themeEngine%22%20AND%20a:%22themeEngine%22)\n[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\nThis library allows you to set Material 3 themes to your app. You can also manage dark mode and dynamic colors in your app. All changes are saved to SharedPreferences no need to manage it manually.\n\n\u003cb\u003eNote\u003c/b\u003e: This library does not support dynamic colors on devices lower than Android 12 i.e. API 31.\n\n## Screenshots\n### Themes \n| Light | Dark |\n|:---:|:---:|\n| \u003cimg src=\"screenshots/light_themes.gif\" width=\"400\"/\u003e| \u003cimg src=\"screenshots/dark_themes.gif\" width=\"400\"/\u003e|\n### Theme Chooser\n| Light | Dark |\n|:---:|:---:|\n| \u003cimg src=\"screenshots/theme_chooser_light.png\" width=\"200\"/\u003e| \u003cimg src=\"screenshots/theme_chooser_dark.png\" width=\"200\"/\u003e|\n\n## How to use\n### Getting Started\nAdd the following gradle dependency to your build.gradle\n```gradle\ndependencies {\n  implementation 'io.github.prathameshmm02.themeEngine:themeEngine:1.0'\n}\n```\n### Usage\nTheming is handled by ThemeEngine class. It is a singleton class and you can get the ThemeEngine instance as follows:\n```kotlin\nval themeEngine = ThemeEngine.getInstance(context)\n```\n\nApply theme and night mode to given activity, in your activity's onCreate() method, call:\n```kotlin\nthemeEngine.applyToActivity(this)\n```\n\nApply theme and night mode to all activities by registering a ActivityLifecycleCallbacks to your application. In your application class’ onCreate() method, call:\n```kotlin\nthemeEngine.applyToActivities(this)\n```\n\nSet Dark theme \n\u003eNote : Dark theme change is handled no need to call activity.recreate()\n```kotlin\n// Light mode\nthemeEngine.themeMode = ThemeMode.LIGHT\n\n// Dark mode\nthemeEngine.themeMode = ThemeMode.DARK\n\n// Follow System\nthemeEngine.themeMode = ThemeMode.AUTO\n```\n    \nSet Dynamic Colors, you may want to recreate activity after settings this property\n```kotlin\nthemeEngine.isDynamicTheme = true\n```\n\nSet static theme\n\u003e The theme used when dynamic color is disabled\n```kotlin\nthemeEngine.staticTheme = R.style.Theme_ThemeEngine_Orange\n```\n\nCreate ThemeChooserDialog for the user to choose static theme from, this returns an AlertDialog.\n```kotlin\nThemeChooserDialogBuilder(this)\n\n    // Set Title\n    .setTitle(R.string.choose_theme)\n    \n    // Set positive button text and an OnClickListener on the button\n    .setPositiveButton(\"OK\") { position, theme -\u003e\n      // This sets staticTheme\n      themeEngine.staticTheme = theme\n      recreate()\n    }\n    \n    // Set negative button text\n    .setNegativeButton(\"Cancel\")\n    \n    // Set neutral button text and an OnClickListener on the button\n    .setNeutralButton(\"Default\") { _, _ -\u003e\n        // This resets static theme\n        themeEngine.resetTheme()\n        // Recreates activity\n        recreate()\n    }\n    \n    // Set Dialog Icon\n    .setIcon(R.drawable.ic_round_brush)\n    \n    // Create Alert Dialog\n    .create()\n    // Show Dialog\n    .show()\n```\n  \nGet current app theme, this returns a dynamic theme when dynamic color is enabled, a static theme otherwise.\n```kotlin\nval theme = themeEngine.getTheme()\n```\n\nReset static theme to default \n```kotlin\nthemeEngine.resetTheme()\n```\n\n## Working\nThemeOverlays are used to apply theme colors to activities. This library contains 20 ThemeOverlays one of which is Dynamic which is used only when dynamic color is enabled other are used by user's choice.  \nThe themes are created with [MaterialThemeBuilder](https://material-foundation.github.io/material-theme-builder/#/custom) by using [Material Colors](https://material.io/design/color/the-color-system.html#tools-for-picking-colors).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprathameshmm02%2FThemeEngine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprathameshmm02%2FThemeEngine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprathameshmm02%2FThemeEngine/lists"}