Android Color Picker aka AmbilWarna library ("Pick a Color" in Indonesian)
Switch branches/tags
Nothing to show
Clone or download
Latest commit 6642dec Apr 26, 2018


Android Color Picker

Maven Central

aka AmbilWarna library ("Pick a Color" in Indonesian)

moved from

This is a small library for your application to enable the users to select an arbitrary color. It is used in the free Bible applications for Android (

It is also used by:

If your application has a feature to customize the color of some background, text, or maybe for a painting application where the user can select different colors for painting or filling, then AmbilWarna is suitable for you.

Adding it to your project

Android Studio 3.0 and above:

dependencies {
    implementation 'com.github.yukuku:ambilwarna:2.0.1'

Android Studio 2.3.* and lower:

dependencies {
    compile 'com.github.yukuku:ambilwarna:2.0.1'


How to use the dialog

Create a color picker dialog by calling the following constructor, and then show it.

AmbilWarnaDialog(Context context, int color, OnAmbilWarnaListener listener)

Alpha is also supported by passing the 3rd parameter supportsAlpha:

AmbilWarnaDialog(Context context, int color, boolean supportsAlpha, OnAmbilWarnaListener listener)


// initialColor is the initially-selected color to be shown in the rectangle on the left of the arrow.
// for example, 0xff000000 is black, 0xff0000ff is blue. Please be aware of the initial 0xff which is the alpha.
AmbilWarnaDialog dialog = new AmbilWarnaDialog(this, initialColor, new OnAmbilWarnaListener() {
	public void onOk(AmbilWarnaDialog dialog, int color) {
		// color is the color selected by the user.
	public void onCancel(AmbilWarnaDialog dialog) {
		// cancel was selected by the user

How to use it as a Preference

Very simple. It works like a DialogPreference that stores an Integer to the shared preferences file.

Just add the following to the preferences xml file.

	android:title="Pick a color" />

To enable alpha, use the application attribute supportsAlpha, as follows:

		android:title="Pick a color with alpha" />


  • Pascal Cans (
  • Justin Warner (One Rainboot Studio)
  • Logo design by anaufalm