{"id":13551638,"url":"https://github.com/kevinomyonga/adaptive_chameleon_theme","last_synced_at":"2025-10-26T16:30:45.519Z","repository":{"id":37850730,"uuid":"426446660","full_name":"kevinomyonga/adaptive_chameleon_theme","owner":"kevinomyonga","description":"A Flutter package that will automatically retrieve your OS defined Theme (Dynamic), force your prefered one (Light / Dark), allow you to present the user with a set of color themes to choose from and of course, persist this choice in your device.","archived":false,"fork":false,"pushed_at":"2024-09-15T18:33:35.000Z","size":573,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-31T21:11:28.552Z","etag":null,"topics":["adaptive","chameleon","customization","dynamic-theme","flutter","theme","theme-switcher","ui"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/adaptive_chameleon_theme","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kevinomyonga.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":["https://www.buymeacoffee.com/KevinOmyonga","https://www.paypal.com/donate/?hosted_button_id=SQNT6QH846BQC"]}},"created_at":"2021-11-10T01:42:41.000Z","updated_at":"2024-08-30T04:00:12.000Z","dependencies_parsed_at":"2024-08-01T12:19:27.046Z","dependency_job_id":"ee51d022-d001-4899-b4f9-0fa54db155ad","html_url":"https://github.com/kevinomyonga/adaptive_chameleon_theme","commit_stats":{"total_commits":36,"total_committers":1,"mean_commits":36.0,"dds":0.0,"last_synced_commit":"71b016dcae44f6c5c239bc6fbda86fb7f4ea1373"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinomyonga%2Fadaptive_chameleon_theme","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinomyonga%2Fadaptive_chameleon_theme/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinomyonga%2Fadaptive_chameleon_theme/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinomyonga%2Fadaptive_chameleon_theme/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kevinomyonga","download_url":"https://codeload.github.com/kevinomyonga/adaptive_chameleon_theme/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238366718,"owners_count":19460172,"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":["adaptive","chameleon","customization","dynamic-theme","flutter","theme","theme-switcher","ui"],"created_at":"2024-08-01T12:01:51.565Z","updated_at":"2025-10-26T16:30:45.128Z","avatar_url":"https://github.com/kevinomyonga.png","language":"Dart","funding_links":["https://www.buymeacoffee.com/KevinOmyonga","https://www.paypal.com/donate/?hosted_button_id=SQNT6QH846BQC","https://img.buymeacoffee.com/button-api/?text=Buy"],"categories":["Dart"],"sub_categories":[],"readme":"\u003c!-- \nThis README describes the package. If you publish this package to pub.dev,\nthis README's contents appear on the landing page for your package.\n\nFor information about how to write a good package README, see the guide for\n[writing package pages](https://dart.dev/guides/libraries/writing-package-pages). \n\nFor general information about developing packages, see the Dart guide for\n[creating packages](https://dart.dev/guides/libraries/create-library-packages)\nand the Flutter guide for\n[developing packages and plugins](https://flutter.dev/developing-packages). \n--\u003e\n\n# Adaptive Chameleon Theme\n\nA Flutter package that will automatically retrieve your OS defined Theme (Dynamic), force your \nprefered one (Light / Dark), allow you to present the user with a set of color themes to choose \nfrom and of course, persist this choice in your device.\n\n[![Pub Version](https://img.shields.io/pub/v/adaptive_chameleon_theme?label=Pub)](https://pub.dev/packages/adaptive_chameleon_theme)\n![GitHub](https://img.shields.io/github/license/KevinOmyonga/adaptive_chameleon_theme)\n[![codecov](https://codecov.io/gh/kevinomyonga/adaptive_chameleon_theme/branch/main/graph/badge.svg?token=O2H0N3MNTX)](https://codecov.io/gh/kevinomyonga/adaptive_chameleon_theme)\n\n\u003ca href=\"https://pub.dev/packages/adaptive_chameleon_theme\"\u003e\n\u003cimg src=\"https://github.com/kevinomyonga/adaptive_chameleon_theme/blob/main/demo/adaptive-chameleon-theme.jpg?raw=true\"/\u003e\n\u003c/a\u003e\n\n\n## Features\n\n* Set default theme\n* Override system theme mode and set yours (light/dark)\n* Change theme colors\n* Customize color palettes for different theme modes\n\n\n## Demo\n\nClick below to watch a quick demo.\n\n[![Alt text](https://img.youtube.com/vi/xCCHCgYo80c/0.jpg)](https://www.youtube.com/watch?v=xCCHCgYo80c)\n\n\n## Getting started\n\nAdd the following dependency to your `pubspec.yaml`\n\n```yaml\ndependencies:\n  adaptive_chameleon_theme: \u003clatest_version\u003e\n```\n\n\n## Usage\n\nThis package allows for an arbitrary number of themes to be defined. Each theme has a unique ID \nof type `int`. To create the themes and map them to IDs, first you have to create an instance of \n`ThemeCollection`, like so:\n\n```dart\nfinal themeCollection = ThemeCollection(\n    themes: {\n        0: ThemeData(primarySwatch: Colors.blue),\n        1: ThemeData(primarySwatch: Colors.red),\n    },\n    fallbackTheme: ThemeData.light(), // optional fallback theme, default value is ThemeData.light()\n);\n```\n\nI would however recommend you introduce a class with `static const int` values to \nassociate a name to each ID value for easier reference:\n\n```dart\n\nclass AppThemes {\n    static const int LightBlue = 0;\n    static const int LightRed = 1;\n}\nfinal themeCollection = ThemeCollection(\n    themes: {\n        AppThemes.LightBlue: ThemeData(primarySwatch: Colors.blue),\n        AppThemes.LightRed: ThemeData(primarySwatch: Colors.red),\n    },\n    fallbackTheme: ThemeData.light(),\n);\nfinal darkThemeCollection = ThemeCollection(\n    themes: {\n        AppThemes.Blue: ThemeData(primarySwatch: Colors.blue),\n        AppThemes.Red: ThemeData(primarySwatch: Colors.red),\n    },\n    fallbackTheme: ThemeData.dark(),\n);\n```\n**NOTE:** Remember to define a collection of dark themes equivalent in number to the normal themes.\n\nProceed to wrap your `MaterialApp` with `AdaptiveChameleonThemeWidget` in order to apply and modify UI \nthemes.\n\n```dart\nimport 'package:example/themes.dart';\nimport 'package:flutter/material.dart';\n\nimport 'package:adaptive_chameleon_theme/adaptive_chameleon_theme.dart';\n\nvoid main() {\n  runApp(MyApp());\n}\n\nclass MyApp extends StatelessWidget {\n\n  @override\n  Widget build(BuildContext context) {\n    return AdaptiveChameleonThemeWidget(\n            themeCollection: AppThemes.themeCollection,\n            darkThemeCollection: AppThemes.darkThemeCollection,\n            defaultThemeId: AppThemes.aokiji, // optional, default id is 0\n            builder: (context, theme, darkTheme, themeMode) {\n              return MaterialApp(\n                title: 'Flutter Demo',\n                theme: theme,\n                darkTheme: darkTheme,\n                themeMode: themeMode,\n                home: const MyHomePage(title: 'Adaptive Chameleon Theme'),\n              );\n            }\n    );\n  }\n}\n```\n\n\n## Changing Theme Mode\n\nYou can utilise the **changeThemeMode** function from anywhere in your app. It provides a simple \nand \nstraight forward way of altering the theme modes: **light to dark, dark to light or to system \ndefault**.\n\nThis function has two optional parameters: *dynamic* and *dark*.\nIf the value of *dynamic* is *true*, it takes precedence over *dark*.\n\n```dart\n  // sets theme mode to dark\n  AdaptiveChameleonTheme.of(context).changeThemeMode(dark: true);\n  \n  // sets theme mode to light\n  AdaptiveChameleonTheme.of(context).changeThemeMode(dark: false);\n  \n  // sets theme mode to system default\n  AdaptiveChameleonTheme.of(context).changeThemeMode(dynamic: true);\n```\n\n## Changing Theme Color\n\nThe theme can be set anywhere in the app, provided you have a `BuildContext`, e.g.:\n\n```dart\n  AdaptiveChameleonTheme.of(context).setTheme(AppThemes.LightRed);\n```\n\nBy setting the theme, its ID is automatically saved via the [\n`shared_preferences`](https://pub.dev/packages/shared_preferences) package, so the next time the \napp starts, the theme can be restored automatically.\n\n\n### How to get the current theme\n\n#### Current app ThemeMode\n\n```dart\n  ThemeMode themeMode = AdaptiveChameleonTheme.of(context).themeMode;  \n```\n\nThe above example will return a value of the *enum* used by **MaterialApp's** **ThemeMode** with one of the following values:\n\n**system** - *Use either the light or dark theme based on what the user has selected in the system settings.*\n\n**light** - *Always use the light mode regardless of system preference.*\n\n**dark** - *Always use the dark mode (if available) regardless of system preference.*\n\n\n#### Current app ThemeId\n\nTo get the ID of the current theme, for example to create a selection UI as done in the example \napp provided with this package, call\n\n```dart\n  final themeId = AdaptiveChameleonTheme.of(context).themeId;\n```\n\n\n## Also Included\n\nThe plugin contains some out-of-the-box widgets to make implementation easier.\n\n### ThemeModeSelectorWidget\n\nThis is a toggle buttons widget that allows you to switch theme modes.\n\n```dart\n  const ThemeModeSelectorWidget()\n```\n\n\u003ca href=\"https://pub.dev/packages/adaptive_chameleon_theme\"\u003e\n\u003cimg src=\"https://github.com/kevinomyonga/adaptive_chameleon_theme/blob/main/demo/theme-mode-selector.jpg?raw=true\"/\u003e\n\u003c/a\u003e\n\n\u003ca href=\"https://pub.dev/packages/adaptive_chameleon_theme\"\u003e\n\u003cimg src=\"https://github.com/kevinomyonga/adaptive_chameleon_theme/blob/main/demo/theme-mode-selector-dark.jpg?raw=true\"/\u003e\n\u003c/a\u003e\n\n### ThemeColorSelectorWidget\n\nThis is a toggle buttons widget that allows you to switch theme colors.\n\n```dart\n  ThemeColorSelectorWidget(\n    themeCollection: AppThemes.themeCollection,\n    selectedTheme: AdaptiveChameleonTheme.of(context).themeId,\n  )\n```\n\n\u003ca href=\"https://pub.dev/packages/adaptive_chameleon_theme\"\u003e\n\u003cimg src=\"https://github.com/kevinomyonga/adaptive_chameleon_theme/blob/main/demo/theme-color-selector.jpg?raw=true\"/\u003e\n\u003c/a\u003e\n\n\n## Example\n\nThe example app can be found in the `example` folder. It implements a dropdown menu to select \nbetween 5 themes. The app is the source for the video demo above.\n\n\n## Showcase\n\nUsing this package in a live app? Let me know and I will add it here.\n\n\n## Maintainer\n\n* [Kevin Omyonga](https://github.com/KevinOmyonga)\n\nIf you experience any problems using this package, please [create an issue on Github](https://github.com/KevinOmyonga/adaptive_chameleon_theme/issues). \nPull requests are also welcome.\n\n\n## Acknowledgements\n\nMany thanks to the projects/packages below that served as inspiration for this undertaking:\n\n* [dynamic_theme](https://pub.dev/packages/dynamic_theme) package from [\n  Norbert Kozsir](https://github.com/Norbert515) \n* [easy_dynamic_theme](https://pub.dev/packages/easy_dynamic_theme) package from \n  [Rene Lazo Mendez](https://github.com/rlazom) \n* [dynamic_themes](https://pub.dev/packages/dynamic_themes) package from [\n  Julian Aßmann](https://github.com/JulianAssmann)\n\n\n#### Liked Adaptive Chameleon Theme?\n\nShow some love and support by starring the repository.\n\nOr You can\n\n\u003ca href=\"https://www.buymeacoffee.com/KevinOmyonga\"\u003e\n\u003cimg src=\"https://img.buymeacoffee.com/button-api/?text=Buy me a coffee\u0026emoji=\u0026slug=KevinOmyonga\u0026button_colour=FFDD00\u0026font_colour=000000\u0026font_family=Cookie\u0026outline_colour=000000\u0026coffee_colour=ffffff\"\u003e\n\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevinomyonga%2Fadaptive_chameleon_theme","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkevinomyonga%2Fadaptive_chameleon_theme","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevinomyonga%2Fadaptive_chameleon_theme/lists"}