项目作者: QuadFlask

项目描述 :
🍭color picker for android
高级语言: Java
项目地址: git://github.com/QuadFlask/colorpicker.git
创建时间: 2015-03-21T07:49:18Z
项目社区:https://github.com/QuadFlask/colorpicker

开源协议:

下载


Color Picker

Android Arsenal
https://img.shields.io/github/tag/QuadFlask/colorpicker.svg?label=maven

icon

simple android color picker with color wheel and lightness bar.

Play Store link

Demo video

Youtube

Screenshot

WHEEL_TYPE.FLOWER

screenshot3.png

WHEEL_TYPE.CIRCLE

screenshot.png

How to add dependency?

This library is not released in Maven Central, but instead you can use JitPack

add remote maven url in allprojects.repositories

  1. allprojects {
  2. repositories {
  3. maven { url "https://jitpack.io" }
  4. }
  5. }

then add a library dependency

  1. dependencies {
  2. implementation 'com.github.QuadFlask:colorpicker:0.0.15'
  3. }

or, you can manually download aar and put into your project’s libs directory.

and add dependency

  1. dependencies {
  2. compile(name:'[arrFileName]', ext:'aar')
  3. }

check out latest version at releases

Usage

As a dialog

  1. ColorPickerDialogBuilder
  2. .with(context)
  3. .setTitle("Choose color")
  4. .initialColor(currentBackgroundColor)
  5. .wheelType(ColorPickerView.WHEEL_TYPE.FLOWER)
  6. .density(12)
  7. .setOnColorSelectedListener(new OnColorSelectedListener() {
  8. @Override
  9. public void onColorSelected(int selectedColor) {
  10. toast("onColorSelected: 0x" + Integer.toHexString(selectedColor));
  11. }
  12. })
  13. .setPositiveButton("ok", new ColorPickerClickListener() {
  14. @Override
  15. public void onClick(DialogInterface dialog, int selectedColor, Integer[] allColors) {
  16. changeBackgroundColor(selectedColor);
  17. }
  18. })
  19. .setNegativeButton("cancel", new DialogInterface.OnClickListener() {
  20. @Override
  21. public void onClick(DialogInterface dialog, int which) {
  22. }
  23. })
  24. .build()
  25. .show();

As a widget

  1. <com.flask.colorpicker.ColorPickerView
  2. android:id="@+id/color_picker_view"
  3. android:layout_width="match_parent"
  4. android:layout_height="wrap_content"
  5. app:alphaSlider="true"
  6. app:density="12"
  7. app:lightnessSlider="true"
  8. app:wheelType="FLOWER"
  9. app:lightnessSliderView="@+id/v_lightness_slider"
  10. app:alphaSliderView="@+id/v_alpha_slider"
  11. ></com.flask.colorpicker.ColorPickerView>
  12. <com.flask.colorpicker.slider.LightnessSlider
  13. android:id="@+id/v_lightness_slider"
  14. android:layout_width="match_parent"
  15. android:layout_height="48dp"
  16. ></com.flask.colorpicker.slider.LightnessSlider>
  17. <com.flask.colorpicker.slider.AlphaSlider
  18. android:id="@+id/v_alpha_slider"
  19. android:layout_width="match_parent"
  20. android:layout_height="48dp"
  21. ></com.flask.colorpicker.slider.AlphaSlider>

To do

  • gradle support
  • performance improvement
  • refactoring

License

  1. Copyright 2014-2017 QuadFlask
  2. Licensed under the Apache License, Version 2.0 (the "License");
  3. you may not use this file except in compliance with the License.
  4. You may obtain a copy of the License at
  5. http://www.apache.org/licenses/LICENSE-2.0
  6. Unless required by applicable law or agreed to in writing, software
  7. distributed under the License is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. See the License for the specific language governing permissions and
  10. limitations under the License.