{"id":18800452,"url":"https://github.com/kunzisoft/androidclearchroma","last_synced_at":"2025-04-13T17:31:14.406Z","repository":{"id":108854767,"uuid":"68000410","full_name":"Kunzisoft/AndroidClearChroma","owner":"Kunzisoft","description":" A material color picker for Android","archived":false,"fork":false,"pushed_at":"2022-01-14T16:49:20.000Z","size":3669,"stargazers_count":46,"open_issues_count":0,"forks_count":11,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-12T12:18:15.076Z","etag":null,"topics":["android","color","picker","preferences"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Kunzisoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2016-09-12T10:43:46.000Z","updated_at":"2025-03-10T05:30:17.000Z","dependencies_parsed_at":"2023-03-17T08:45:35.594Z","dependency_job_id":null,"html_url":"https://github.com/Kunzisoft/AndroidClearChroma","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kunzisoft%2FAndroidClearChroma","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kunzisoft%2FAndroidClearChroma/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kunzisoft%2FAndroidClearChroma/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kunzisoft%2FAndroidClearChroma/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kunzisoft","download_url":"https://codeload.github.com/Kunzisoft/AndroidClearChroma/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248752366,"owners_count":21156078,"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","color","picker","preferences"],"created_at":"2024-11-07T22:18:44.150Z","updated_at":"2025-04-13T17:31:14.401Z","avatar_url":"https://github.com/Kunzisoft.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![](https://jitpack.io/v/Kunzisoft/AndroidClearChroma.svg)](https://jitpack.io/#Kunzisoft/AndroidClearChroma)\n\n# AndroidClearChroma\n\n\u003cimg src=\"https://raw.githubusercontent.com/Kunzisoft/AndroidClearChroma/master/art/logo.png\"\u003e A customisable material color picker view for Android.\n\n\u003cimg src=\"https://raw.githubusercontent.com/Kunzisoft/AndroidClearChroma/master/art/movie1.gif\" width=\"505\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/Kunzisoft/AndroidClearChroma/master/art/screen1.png\" width=\"250\"\u003e\n\n   - supports RGB, ARGB, HSV, HSL, CMYK, CMYK255 color modes (with alpha preview)\n   - can indicate current color in either DECIMAL or HEXADECIMAL mode\n   - can be used as Dialog, Fragment or as Preference.\n   - can select custom shape for preview color in preference\n   - add color as part of summary string\n\n## Contribution\n\nYou can contribute in different ways to help.\n\n* Add features by a **[pull request](https://help.github.com/articles/about-pull-requests/)**.\n* **[Donate](https://www.kunzisoft.com/donation)**  (｡◕‿◕｡)  will be used to create free and open source applications.\n\n\n## Installation\nAdd the JitPack repository in your build.gradle at the end of repositories:\n```\n\tallprojects {\n\t\trepositories {\n\t\t\t...\n\t\t\tmaven { url \"https://jitpack.io\" }\n\t\t}\n\t}\n```\nAnd add the dependency\n[![](https://jitpack.io/v/Kunzisoft/AndroidClearChroma.svg)](https://jitpack.io/#Kunzisoft/AndroidClearChroma)\n*replacing ${version} with the version number in jitpack*\n```\n\tdependencies {\n\t        implementation 'com.github.Kunzisoft:AndroidClearChroma:${version}'\n\t}\n```\nAndroidClearChroma uses AndroidX as compat library.\n\n## Usage\n\n### ChromaColorView\n\nTo display a color view in a layout\n``` xml\n    \u003ccom.kunzisoft.androidclearchroma.view.ChromaColorView\n        xmlns:chroma=\"http://schemas.android.com/apk/res-auto\"\n        android:id=\"@+id/chroma_color_view\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        chroma:chromaInitialColor=\"@color/colorAccent\"\n        chroma:chromaColorMode=\"HSV\"\n        chroma:chromaIndicatorMode=\"HEX\" /\u003e\n```\n#### Attributes\n * `chroma:chromaInitialColor` \tdefault color\n * `chroma:chromaColorMode` \tRGB, ARGB, HSV, HSL, CMYK or CMYK255\n * `chroma:chromaIndicatorMode`\tHEX or DECIMAL\n\nSee [ViewColorActivity.java](https://github.com/Kunzisoft/AndroidClearChroma/blob/master/sample/src/main/java/com/kunzisoft/androidclearchroma/sample/ViewColorActivity.java) for complete sample.\n\n### ChromaDialog\n\nTo display a color picker `DialogFragment` from your Activity:\n``` java\nnew ChromaDialog.Builder()\n    .initialColor(Color.GREEN)\n    .colorMode(ColorMode.ARGB) // RGB, ARGB, HVS, CMYK, CMYK255, HSL\n    .indicatorMode(IndicatorMode.HEX) //HEX or DECIMAL; Note that (HSV || HSL || CMYK) \u0026\u0026 IndicatorMode.HEX is a bad idea\n    .create()\n    .show(getSupportFragmentManager(), \"ChromaDialog\");\n```\n\nTo display a color picker `DialogFragment` from your Fragment:\n``` java\nnew ChromaDialog.Builder()\n    .initialColor(Color.GREEN)\n    .colorMode(ColorMode.ARGB) // RGB, ARGB, HVS, CMYK, CMYK255, HSL\n    .indicatorMode(IndicatorMode.HEX) //HEX or DECIMAL; Note that (HSV || HSL || CMYK) \u0026\u0026 IndicatorMode.HEX is a bad idea\n    .create()\n    .show(getChildFragmentManager(), \"ChromaDialog\");\n```\n\n### Fragment\n\n\u003cimg src=\"https://raw.githubusercontent.com/Kunzisoft/AndroidClearChroma/master/art/screen2.png\" width=\"250\"\u003e\n\nSimply call it in XML layout with :\n```\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003cFrameLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:orientation=\"vertical\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\u003e\n\n    \u003cfragment android:name=\"com.kunzisoft.androidclearchroma.fragment.ChromaColorFragment\"\n        android:id=\"@+id/activity_color_fragment\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        tools:layout=\"@layout/chroma_color_fragment\" /\u003e\n\n\u003c/FrameLayout\u003e\n```\nUnfortunately, you can't customize a fragment in XML. You must initialize the fragment programmatically and use the FragmentManager to add it to your layouts.\n\nExample :\n```java\n    ChromaColorFragment chromaColorFragment = ChromaColorFragment.newInstance(Color.BLUE, ColorMode.ARGB, IndicatorMode.HEX);\n    getSupportFragmentManager()\n    .beginTransaction()\n    .replace(R.id.container_color_fragment, chromaColorFragment, TAG_COLOR_FRAGMENT)\n    .commit();\n```\nSee [FragmentColorActivity.java](https://github.com/Kunzisoft/AndroidClearChroma/blob/master/sample/src/main/java/com/kunzisoft/androidclearchroma/sample/FragmentColorActivity.java) for complete sample.\n\n### Listeners\n\nYour parent Activity or Fragment must implement the listener interfaces.\n\n#### OnColorSelectedListener\n*OnColorSelectedListener* contains two methods : \n`void onPositiveButtonClick(@ColorInt int color)`called when positiveButton is clicked and\n`void onNegativeButtonClick(@ColorInt int color)` called when negativeButton is clicked.\n\n#### OnColorChangedListener\n*OnColorChangedListener* contains method\n `void onColorChanged(@ColorInt int color)` called when color is changed in view.\n \n See [MainActivity.java](https://github.com/Kunzisoft/AndroidClearChroma/blob/master/sample/src/main/java/com/kunzisoft/androidclearchroma/sample/MainActivity.java) for complete sample of ChromaDialog\n\n## Style\n\n\u003cimg src=\"https://raw.githubusercontent.com/Kunzisoft/AndroidClearChroma/master/art/screen4.png\" width=\"505\"\u003e\n\nAndroidClearChroma uses the DialogFragment style of your app.\n\n### Preference\n\nYou must add a `preferenceTheme` node in your activity :\n```\n\u003cstyle name=\"AppTheme.Settings\" parent=\"AppTheme\"\u003e\n\t\u003citem name=\"preferenceTheme\"\u003e@style/PreferenceThemeOverlay.v14.Material\u003c/item\u003e\n\u003c/style\u003e\n```\nor (for API \u003c 14)\n```\n\u003cstyle name=\"AppTheme.Settings\" parent=\"AppTheme\"\u003e\n\t\u003citem name=\"preferenceTheme\"\u003e@style/PreferenceThemeOverlay\u003c/item\u003e\n\u003c/style\u003e\n```\n\n\u003cimg src=\"https://raw.githubusercontent.com/Kunzisoft/AndroidClearChroma/master/art/screen3.png\" width=\"250\"\u003e\n\n**A.** Add Preference to your *.xml preference layout:\n``` xml\n    \u003ccom.kunzisoft.androidclearchroma.ChromaPreferenceCompat\n    \txmlns:chroma=\"http://schemas.android.com/apk/res-auto\"\n        android:key=\"chroma_preference_key\"\n        android:title=\"HSV sample\"\n        android:summary=\"text and [color] string\"\n        android:defaultValue=\"@color/colorAccent\"\n        chroma:chromaShapePreview=\"ROUNDED_SQUARE\"\n        chroma:chromaColorMode=\"HSV\"\n        chroma:chromaIndicatorMode=\"HEX\" /\u003e\n```\n#### Attributes\n * Add [color] in `summary` to show current color as string\n * `chroma:chromaInitialColor` \tdefault color\n * `chroma:chromaColorMode` \tRGB, ARGB, HSV, HSL, CMYK or CMYK255\n * `chroma:chromaIndicatorMode`\tHEX or DECIMAL\n * `chroma:chromaShapePreview` \tCIRCLE, SQUARE or ROUNDED_SQUARE\n\n**B.** Or you can add preferences dynamically from the code:\n```java\n    ChromaPreferenceCompat pref = new ChromaPreferenceCompat(getContext());\n    pref.setTitle(\"RGB(added from java)\");\n    pref.setSummary(\"Summary ...\");\n    pref.setColorMode(ColorMode.RGB);\n    pref.setIndicatorMode(IndicatorMode.HEX);\n    pref.setKey(\"any_key_you_need\");\n    getPreferenceScreen().addPreference(pref);\n```\n\nUse `ChromaPreferenceFragmentCompat` as a superclass for managing fragments in Preferences.\n\n```\npublic class ColorPreferenceFragmentCompat extends ChromaPreferenceFragmentCompat {\n\n        @Override\n        public void onCreatePreferences(Bundle bundle, String s) {\n            addPreferencesFromResource(R.xml.prefs); // load your ChromaPreferenceCompat prefs from xml\n        }\n    }\n```\nThen get the color from the preference.\n```\nSharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);\n@ColorRes int color = preferences.getInt(\"chroma_preference_key\", ContextCompat.getColor(context, R.color.colorPrimary));\n```\n\n## Bonus\nMethod for formatted output of a given color:\n```java\nChromaUtil.getFormattedColorString(int color, boolean showAlpha);\n```\n\n[Video](https://www.youtube.com/watch?v=zskKV6ifRfw) for create the sample icon (in French)\n\nThis project is a fork of [VintageChroma by Pavel Sikun](https://github.com/MrBIMC/VintageChroma).\n\n## License\nCopyright 2019 JAMET Jeremy.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkunzisoft%2Fandroidclearchroma","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkunzisoft%2Fandroidclearchroma","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkunzisoft%2Fandroidclearchroma/lists"}