项目作者: Madrapps

项目描述 :
An android color picker library
高级语言: Kotlin
项目地址: git://github.com/Madrapps/Pikolo.git
创建时间: 2017-06-02T16:15:55Z
项目社区:https://github.com/Madrapps/Pikolo

开源协议:Apache License 2.0

下载


Pikolo

An android color picker library

previewpreviewpreview

Download

  1. repositories {
  2. mavenCentral()
  3. }
  4. dependencies {
  5. implementation 'com.github.madrapps:pikolo:2.0.2'
  6. }

Features

  • Includes HSLColorPicker and RGBColorPicker
  • 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:

  1. final ColorPicker colorPicker = findViewById(R.id.colorPicker);
  2. colorPicker.setColorSelectionListener(new SimpleColorSelectionListener() {
  3. @Override
  4. public void onColorSelected(int color) {
  5. // Do whatever you want with the color
  6. imageView.getBackground().setColorFilter(color, PorterDuff.Mode.MULTIPLY);
  7. }
  8. });

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.