1
0
Fork
You've already forked android-color-picker
0
Fork of jordanrobinson/android-color-picker from MSGH
  • Java 95.9%
  • Makefile 4.1%
Find a file
2026年06月10日 20:12:59 +03:00
android-color-picker Update Gradle 2026年06月10日 20:12:59 +03:00
gradle/wrapper Update Gradle 2026年06月10日 20:12:59 +03:00
.gitignore Oops, dangerous typo 2015年04月03日 15:26:18 +01:00
.gitmodules Adds submodule of the initial repo 2015年04月03日 11:31:37 +01:00
build.gradle Update Gradle 2026年06月10日 20:12:59 +03:00
gradlew Fix build. Add gradlew 2025年04月02日 20:50:10 +03:00
LICENSE Initial commit 2015年04月03日 11:29:41 +01:00
README.md Version bump! 2017年10月14日 20:49:53 +01:00
settings.gradle Update Gradle 2026年06月10日 20:12:59 +03:00

Android Color Picker

The AOSP color picker, neatly packaged for gradle builds

What is it

Android color picker is the stock color picker that comes bundled in a few apps distributed by Google, with the calendar app being the main example. It allows you to specify a list of colors, show the user a dialog, and get the result. Nice and simple.

example-use

Why is it here?

I needed a color picker for Android, the stock color picker was exactly what I wanted, but grabbing the source, compiling down and using a local repository compiled to an AAR is nowhere near as fun as a Gradle dep.

How do I use it

In your build file:

compile 'uk.co.jordanrobinson:android-color-picker:1.0.2'

in your layout:

<Button
 android:id="@+id/color_picker"
 android:layout_width="fill_parent"
 android:layout_height="60dip"
 android:onClick="showColourPicker"
 android:text="Pick a colour!"
 android:gravity="center" />

in your activity:

import com.android.colorpicker.ColorPickerDialog;
import com.android.colorpicker.ColorPickerSwatch;
public void showColourPicker(View view) {
 final ColorPickerDialog colorPickerDialog = new ColorPickerDialog();
 colorPickerDialog.initialize(R.string.color_picker_default_title,
 new int[] {
 getResources().getColor(R.color.GlobalColorDark),
 getResources().getColor(R.color.ThemeOneDark),
 getResources().getColor(R.color.ThemeTwoDark),
 getResources().getColor(R.color.ThemeThreeDark),
 getResources().getColor(R.color.ThemeFourDark),
 getResources().getColor(R.color.ThemeFiveDark),
 getResources().getColor(R.color.ThemeSixDark),
 getResources().getColor(R.color.ThemeSevenDark),
 getResources().getColor(R.color.ThemeEightDark),
 getResources().getColor(R.color.ThemeNineDark),
 getResources().getColor(R.color.ThemeTenDark),
 getResources().getColor(R.color.ThemeElevenDark),
 }, getResources().getColor(R.color.ThemeOneDark), 3, 2);
 colorPickerDialog.setOnColorSelectedListener(new ColorPickerSwatch.OnColorSelectedListener() {
 @Override
 public void onColorSelected(int colour) {
 YourActivity.this.setYourFragmentBackgroundColour(colour);
 }
 });
 android.app.FragmentManager fm = this.getFragmentManager();
 colorPickerDialog.show(fm, "colorpicker");
}

And you're good to go!

When will it update?

If there are bugs and fixes that come from downstream, I'll update if I notice them myself, or if anyone raises an issue I'll do my best to keep up.

Contributions are of course always welcome, but to avoid disappointment, send me a message if you're making any radical changes to make sure it's the kind of thing I'm expecting. Thanks!

I'm not going to rule out new features coming from me, but at present they aren't really needed by me. Feel free to submit requests though!

Who did this?

That would be me.