# ColorPicker **Repository Path**: duanhong169/ColorPicker ## Basic Information - **Project Name**: ColorPicker - **Description**: A `ColorPicker` for Android. Pick a color using color wheel and slider (HSV & alpha). - **Primary Language**: Android - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 8 - **Forks**: 2 - **Created**: 2018-07-17 - **Last Updated**: 2025-06-25 ## Categories & Tags **Categories**: android-modules **Tags**: None ## README # ColorPicker [![gitHub release](https://img.shields.io/github/release/duanhong169/ColorPicker.svg?style=social)](https://github.com/duanhong169/ColorPicker/releases) [![platform](https://img.shields.io/badge/platform-android-brightgreen.svg)](https://developer.android.com/index.html) [![license](https://img.shields.io/badge/license-Apache%202-green.svg)](https://github.com/duanhong169/Camera/blob/master/LICENSE) A `ColorPicker` for Android. Pick a color using color wheel and slider (HSV & alpha). ## Gradle ``` dependencies { implementation 'com.github.duanhong169:colorpicker:${latestVersion}' ... } ``` > Replace `${latestVersion}` with the latest version code. See [releases](https://github.com/duanhong169/ColorPicker/releases). ## Usage ### Using `ColorPickerPopup` ```java new ColorPickerPopup.Builder(this) .initialColor(Color.RED) // Set initial color .enableAlpha(true) // Enable alpha slider or not .okTitle("Choose") .cancelTitle("Cancel") .showIndicator(true) .showValue(true) .build() .show(v, new ColorPickerPopup.ColorPickerObserver() { @Override public void onColorPicked(int color) { v.setBackgroundColor(color); } @Override public void onColor(int color, boolean fromUser) { } }); ``` ### Using `ColorPickerView` * Add `ColorPickerView` into your layout xml: ```xml ``` > See [`top_defaults_view_color_picker_attrs.xml`](./colorpicker/src/main/res/values/top_defaults_view_color_picker_attrs.xml) for all supported attributes. * Implement `ColorObserver` and subscribe to `ColorPickerView` to receive color updates from the `ColorPickerView`: ```java colorPickerView.subscribe((color, fromUser) -> { // use the color }); ``` * Set initial color: ```java colorPickerView.setInitialColor(0x7F313C93); ``` * Reset to initial color: ```java colorPickerView.reset(); ``` See a complete usage in the app sample code. ## License See the [LICENSE](./LICENSE) file.