Pikolo
An android color picker library
Download
repositories {
mavenCentral()
}
dependencies {
implementation 'com.github.madrapps:pikolo:2.0.2'
}
Features
- Includes
HSLColorPicker
andRGBColorPicker
- Full customization of the various parts of the color picker (like arc length, arc position, indicator size, color, etc...) using XML attributes
Usage
Add the HSLColorPicker
or RGBColorPicker
view to your layout and use it in code as below:
final ColorPicker colorPicker = findViewById(R.id.colorPicker);
colorPicker.setColorSelectionListener(new SimpleColorSelectionListener() {
@Override
public void onColorSelected(int color) {
// Do whatever you want with the color
imageView.getBackground().setColorFilter(color, PorterDuff.Mode.MULTIPLY);
}
});
You can take a look at the sample app to see how the color picker can be customised. There are 3 components in both pickers. You can change their properties together or individually. For instance, arc_length
changes the length of the arc for all 3 components, while hue_arc_length
affects only the Hue component. Various other XML attributes are as follows:
arc_width
- width (thickness) of the components
arc_length
- length of the components
stroke_width
- width of the stroke of the components
stroke_color
- stroke color of the components
indicator_radius
- radius of the control indicator used to change color
indicator_stroke_width
- stroke width of indicator
indicator_stroke_color
- stroke color of indicator
radius_offset
- the offset of the components from the center of the picker
License
Pikolo by Madrapps is licensed under a Apache License 2.0.