Skip to content
Advertisement

How to implement a circular color picker in Android? [closed]

How can I build a color picker as given in the image using android? when an indicator is placed on a color I should be able to get the RGB value.

enter image description here

Answer

I found this library and it worked. We can get the RGB value from this as follows.

picker.setOnColorChangedListener(new ColorPicker.OnColorChangedListener() {
    @Override
    public void onColorChanged(int color) {
        String hexColor = String.format("#%06X", (0xFFFFFF & color));
        int red = Color.red(color);
        int green = Color.green(color);
        int blue = Color.blue(color);
        Log.d("Color2", "" + hexColor+"  ,"+"R:"+red+" ,"+"G:"+green+" ,"+"B:"+blue+" ,");
    }
});
Advertisement