{"id":22283678,"url":"https://github.com/fennifith/colorpickerdialog","last_synced_at":"2025-10-08T11:02:14.500Z","repository":{"id":97398818,"uuid":"79444371","full_name":"fennifith/ColorPickerDialog","owner":"fennifith","description":"A simple dialog making it quick and easy to add color picking functionality to any app.","archived":false,"fork":false,"pushed_at":"2021-03-20T23:19:20.000Z","size":2272,"stargazers_count":137,"open_issues_count":4,"forks_count":20,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-05T04:11:13.277Z","etag":null,"topics":["android","android-library","android-ui","color-picker","dialog","image-picker"],"latest_commit_sha":null,"homepage":"https://jitpack.io/#me.jfenn/ColorPickerDialog","language":"Java","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/fennifith.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-01-19T10:54:16.000Z","updated_at":"2025-01-26T10:16:04.000Z","dependencies_parsed_at":"2023-03-13T16:14:27.949Z","dependency_job_id":null,"html_url":"https://github.com/fennifith/ColorPickerDialog","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/fennifith/ColorPickerDialog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fennifith%2FColorPickerDialog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fennifith%2FColorPickerDialog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fennifith%2FColorPickerDialog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fennifith%2FColorPickerDialog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fennifith","download_url":"https://codeload.github.com/fennifith/ColorPickerDialog/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fennifith%2FColorPickerDialog/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261361893,"owners_count":23147288,"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","android-ui","color-picker","dialog","image-picker"],"created_at":"2024-12-03T16:41:38.202Z","updated_at":"2025-10-08T11:02:09.451Z","avatar_url":"https://github.com/fennifith.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"ColorPickerDialog\n[![JitPack](https://jitpack.io/v/me.jfenn/ColorPickerDialog.svg)](https://jitpack.io/#me.jfenn/ColorPickerDialog)\n![Gradle Build](https://github.com/fennifith/ColorPickerDialog/workflows/Gradle%20Build/badge.svg)\n[![Discord](https://img.shields.io/discord/514625116706177035.svg?logo=discord\u0026colorB=7289da)](https://discord.jfenn.me/)\n=====\n\nColorPickerDialog is a simple dialog making it quick and easy to add a color picker functionality to any app.\n\nFor testing and experimentation purposes, a sample apk can be downloaded [here](https://jfenn.me/projects/colorpickerdialog).\n\n| RGB(A) Picker | HSV Picker | Preset Picker | Image Picker (Tab) | Image Picker (Images) | Dark Theme |\n|---------------|------------|---------------|--------------------|-----------------------|------------|\n| ![Screenshot](./.github/images/rgba.png?raw=true) | ![Screenshot](./.github/images/hsv.png?raw=true) | ![Screenshot](./.github/images/presets.png?raw=true) | ![Screenshot](./.github/images/images.png?raw=true) | ![Screenshot](./.github/images/image.png?raw=true) | ![Screenshot](./.github/images/darktheme.png?raw=true) |\n\n## Usage\n\n### Setup\n\nThis project is published on [JitPack](https://jitpack.io), which you can add to your project by copying the following to your root build.gradle at the end of \"repositories\".\n\n```gradle\nallprojects {\n  repositories {\n    ...\n    maven { url 'https://jitpack.io' }\n  }\n}\n```\n\nTo add the dependency, copy this line into your app module's build.gradle file.\n\n```gradle\nimplementation 'me.jfenn.ColorPickerDialog:base:0.2.2'\n```\n\n### Creating a Dialog\n\nThe basic requirements for the dialog are a default color and a listener, and though none of them _have_ to be specified, it is usually a good idea. You can create a simple dialog fragment using the snippet below:\n\n```java\nnew ColorPickerDialog()\n  .withColor(color) // the default / initial color\n  .withListener(new OnColorPickedListener\u003cColorPickerDialog\u003e() {\n    @Override\n    public void onColorPicked(@Nullable ColorPickerDialog dialog, int color) {\n      // a color has been picked; use it\n    }\n  })\n  .show(getSupportFragmentManager(), \"colorPicker\");\n```\n\nAlternatively, if you are creating the dialog from a fragment, you should use `getChildFragmentManager()` instead of `getSupportFragmentManager()`.\n\n### Alpha\n\nYou can call `.withAlpha(boolean)` to specify whether you want the color's alpha channel to be configurable by the user (if not, all output colors will be fully opaque). This option is enabled by default. A somewhat unnecessary example:\n\n```java\nnew ColorPickerDialog(this)\n  .withAlphaEnabled(false) // disable the alpha channel\n  .withListener(...)\n  .show();\n```\n\n### Alternative Pickers\n\nBy default, the dialog gives the user three ways to enter a color; they can use RGB sliders, HSV sliders, or enter the hex value into the text box at the top.\n\nThere are also some alternative pickers that can be enabled to serve a few different purposes.\n\n#### Presets\n\nThe `.withPresets()` method will enable the \"preset\" color picker, which simply displays a grid of preset colors for the user to choose from. These colors can be configured by passing them (either as an array or varargs) to the `.withPresets()` method, like below:\n\n```java\nnew ColorPickerDialog()\n    .withPresets(Color.RED, Color.GREEN, Color.BLUE)\n    .withListener(...)\n    .show(getSupportFragmentManager(), \"colorPicker\");\n```\n\n#### Images\n\nThere is an optional dependency that adds image picking functionality to the color picker; the user can select an image and then select a color from the image they have chosen.\n\nTo enable it, add the following to your `build.gradle` file along with the dependency from before:\n\n```java\nimplementation 'me.jfenn.ColorPickerDialog:imagepicker:0.2.2'\n```\n\nNext, you will need to declare the following permissions in your `AndroidManifest.xml` (the library does not do it for you).\n\n```xml\n\u003cuses-permission android:name=\"android.permission.READ_EXTERNAL_STORAGE\"/\u003e\n\u003cuses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/\u003e\n```\n\nNow you should be able to add an image picker to your dialog by calling `.withPicker(ImagePickerView.class)` like below:\n\n```java\nnew ColorPickerDialog()\n    .withPicker(ImagePickerView.class)\n    .withListener(...)\n    .show(getSupportFragmentManager(), \"colorPicker\");\n```\n\n### Theming\n\nYou can theme this dialog by passing your custom theme to `.withTheme(int)`. Support for full \"runtime\" theming may come later, but now is not later, so you can't do that yet. Here's an example of a `ColorPickerDialog` with a basic dark theme, demonstrating some of the options that you can specify.\n\n```java\nnew ColorPickerDialog()\n    .withTheme(R.style.ColorPickerDialog_Dark)\n    .show(getSupportFragmentManager(), \"colorPicker\");\n```\n\n```xml\n\u003cstyle name=\"ColorPickerDialog.Dark\" parent=\"Theme.AppCompat.Dialog\"\u003e\n  \u003citem name=\"redColor\"\u003e#FF5252\u003c/item\u003e\n  \u003citem name=\"greenColor\"\u003e#FF5252\u003c/item\u003e\n  \u003citem name=\"blueColor\"\u003e#536DFE\u003c/item\u003e\n  \u003citem name=\"neutralColor\"\u003e#FFFFFF\u003c/item\u003e\n\u003c/style\u003e\n```\n\nThe `redColor`, `greenColor`, and `blueColor` attributes affect the RGB sliders, and the `neutralColor` attribute changes the \"neutral\" colors of the others, including the alpha slider and the handles of the sliders in the HSL picker.\n\n#### Rounded Corners\n\nThe dialog also supports custom values for the rounded corners, which you can specify by calling `.withCornerRadius(float)` with the dp measurement of the corner radius, or `.withCornerRadiusPx(int)` with a pixel measurement.\n\n## Other Documentation\n\nNot only am I lazy, I also miss things, so this page may not describe every feature that this library is capable of. However, the majority of this library's documentation is actually written as javadocs within the source code. You can find the generated documentation pages for it [here](https://jfenn.me/projects/colorpickerdialog/docs/).\n\n### Proguard / Minification\n\nFor those using the R8 compiler, this library's [proguard rules](./base/consumer-rules.pro) should be conveniently bundled with the library already - otherwise, you will need to add them to your app's `proguard-rules.pro` file yourself to prevent running into any issues with `minifyEnabled` and the like.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffennifith%2Fcolorpickerdialog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffennifith%2Fcolorpickerdialog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffennifith%2Fcolorpickerdialog/lists"}