GitHub Issues Apache License 2.0 JitPack ColorPickerDialog.apk (0.1.0 stable)


fennifith jahirfiquitiva
All Projects

Color Picker Dialog


ColorPickerDialog is a simple dialog making it quick and easy to add a color picker functionality to any app.


For testing and experimentation purposes, a sample apk can be downloaded here.

Color Picker No Alpha Dark Theme
img img img



This project is published on JitPack, which you can add to your project by copying the following to your root build.gradle at the end of “repositories”.

allprojects {
  repositories {
    maven { url '' }

To add the dependency, copy this line into your app module’s build.gradle file.

implementation 'me.jfenn:ColorPickerDialog:0.1.0'

Creating a Dialog

The basic requirements for the dialog are a context, color, and listener, though none of them have to be specified. If you don’t specify a listener, though, you can’t do anything with the color picked by the dialog, which is not very good.

new ColorPickerDialog(this) // context
  .withColor(color) // the default / initial color
  .withListener(new ColorPickerDialog.OnColorPickedListener() {
    public void onColorPicked(ColorPickerDialog dialog, int color) {
      // a color has been picked; use it


You can also call .withAlpha(boolean) to specify whether you want the colors’ alpha 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:

new ColorPickerDialog(this)
  .withAlphaEnabled(false) // disable the alpha


You can theme this dialog the same as any other: by passing a second parameter (a style resource) to its constructor. Full “runtime” theming will 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 all of the options you can specify.

new ColorPickerDialog(this,;
<style name="ColorDialog.Dark" parent="Theme.AppCompat.Dialog">
  <item name="redColor">#FF5252</item>
  <item name="greenColor">#FF5252</item>
  <item name="blueColor">#536DFE</item>
  <item name="neutralColor">#FFFFFF</item>

The 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.

Last updated: 2018-12-26 20:23:39 +0000

This site may do shady things with cookies and stuff because it's evil. Please don't read my privacy policy. close