An Android Holo themed colorpicker designed by Marie Schweiz

Overview

Android Holo ColorPicker

Marie Schweiz http://marie-schweiz.de/ made a beautifull new design for the Holo ColorPicker which added a lot of new functionality.

You can now set the Saturation and Value of a color. Also its possible to set the Opacity for a color.

You can also set the last selected color and see the difference with the new selected color.

Demo can be found on my Google Drive here if interested. the code of the sample can be found at a gist here

image image

UDPATE

Now bars can change their orientation, Thanks to [tonyr59h](https://github.com/tonyr59h) also the gradle build version was updated to 0.7.+ ![image](https://lh5.googleusercontent.com/-3KSukk_S94Y/UvKiNER-OBI/AAAAAAAAA-k/8SPfOmFhLjE//device-2014-02-05-180704_framed.png)

Documentation

To add the ColorPicker to your layout add this to your xml

<com.larswerkman.holocolorpicker.ColorPicker
    android:id="@+id/picker"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>

To add a Saturation/Value bar to your layout add this to your xml

<com.larswerkman.holocolorpicker.SVBar
    android:id="@+id/svbar"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>

The same goes for the Opacity bar

<com.larswerkman.holocolorpicker.OpacityBar
    android:id="@+id/opacitybar"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>

Saturation bar

<com.larswerkman.holocolorpicker.SaturationBar
    android:id="@+id/saturationbar"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>

and a Value bar

<com.larswerkman.holocolorpicker.ValueBar
    android:id="@+id/valuebar"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>

To connect the bars with the colorpicker and to get the selected color.

ColorPicker picker = (ColorPicker) findViewById(R.id.picker);
SVBar svBar = (SVBar) findViewById(R.id.svbar);
OpacityBar opacityBar = (OpacityBar) findViewById(R.id.opacitybar);
SaturationBar saturationBar = (SaturationBar) findViewById(R.id.saturationbar);
ValueBar valueBar = (ValueBar) findViewById(R.id.valuebar);
	
picker.addSVBar(svBar);
picker.addOpacityBar(opacityBar);
picker.addSaturationBar(saturationBar);
picker.addValueBar(valueBar);

//To get the color
picker.getColor();

//To set the old selected color u can do it like this
picker.setOldCenterColor(picker.getColor());
// adds listener to the colorpicker which is implemented
//in the activity
picker.setOnColorChangedListener(this);

//to turn of showing the old color
picker.setShowOldCenterColor(false);

//adding onChangeListeners to bars
opacitybar.setOnOpacityChangeListener(new OnOpacityChangeListener …)
valuebar.setOnValueChangeListener(new OnValueChangeListener …)
saturationBar.setOnSaturationChangeListener(new OnSaturationChangeListener …)

Dependency

Adding it as a dependency to your project.
dependencies {
	compile 'com.larswerkman:HoloColorPicker:1.5'
}

License

 Copyright 2012 Lars Werkman

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.

Devoleped By

**Lars Werkman**
Comments
  • SetColor and GetColor Issues

    SetColor and GetColor Issues

    Dear users of HoloColorPicker,

    I am aware of the issue, but due to school and work I havent had much time to resolve it. It will try to work it out as soon as possible!!

    Thanks Lars

    invalid wontfix 
    opened by LarsWerkman 8
  • Crash when adding bars to picker

    Crash when adding bars to picker

    Hi, first off, I like your color picker a lot and I want to thank you for developing it and releasing it to the public. I have been trying to make use of your color picker in my own project, however I ran into some problems:

    When I try to add a bar to the ColorPicker, my android app crashes with an "Unfortunately, your app has stopped." error.

    Code: Dialog d = new Dialog(this); d.setTitle("Color Picker:"); d.setContentView(R.layout.dialog_colorpicker); ColorPicker picker = (ColorPicker) findViewById(R.id.picker); SVBar svBar = (SVBar) findViewById(R.id.svbar); OpacityBar opacityBar = (OpacityBar) findViewById(R.id.opacitybar); picker.addSVBar(svBar); picker.addOpacityBar(opacityBar); d.show();

    Layout XML:

    <com.larswerkman.holocolorpicker.ColorPicker
        android:id="@+id/picker"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"/>
    
    <com.larswerkman.holocolorpicker.SVBar
        android:id="@+id/svbar"
        android:layout_width="322dp"
        android:layout_height="112dp"
        android:layout_gravity="center"
        android:layout_margin="8dip"/>
    
    <com.larswerkman.holocolorpicker.OpacityBar
        android:id="@+id/opacitybar"
        android:layout_width="322dp"
        android:layout_height="112dp"
        android:layout_gravity="center"
        android:layout_margin="8dip"/>
    
    If I don't add the bars to the picker, everything runs fine and the dialog gets displayed.

    Furthermore I would like to add that viewing the dialog_colorpicker.xml in Design mode gives a "Render error: Render error" in android studio. In Text mode everything is fine.

    For the record I am fairly new to android development and have just started using android studio, so it is possible I have included/imported something wrong. But seeing as it displays just fine when I don't add the bars to the picker, everything appears to have been included fine.

    opened by JKlessens 7
  • Picker change SVBar values incorrect

    Picker change SVBar values incorrect

    I'm using your lib in dilog like that:

    
            AlertDialog.Builder adb = new AlertDialog.Builder(getActivity()).setTitle(title);
            LayoutInflater dialogInflater = getActivity().getLayoutInflater();
            View colorPickerLayout = dialogInflater.inflate(R.layout.dialog_colorpicker, null); //here I got only ColorPicker and svbar
            adb.setView(colorPickerLayout);
            final ColorPicker picker = (ColorPicker) colorPickerLayout.findViewById(R.id.picker);
            SVBar svBar = (SVBar) colorPickerLayout.findViewById(R.id.svbar);
            picker.addSVBar(svBar);
            //trying different ways to set new as old color exactly, but SVbar change position every time
            picker.setOldCenterColor(color);
            picker.setColor(color);
            svBar.setColor(color);
            adb.setPositiveButton("Set", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    listener.onBlurredAlertDialogPositiveClick(BlurredColorPickerDialog.this, picker.getColor());
                }
                })
                .setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        listener.onBlurredAlertDialogNegativeClick(BlurredColorPickerDialog.this);
                    }
                })
                .setOnCancelListener(new DialogInterface.OnCancelListener() {
                    public void onCancel(DialogInterface dialog) {
                        listener.onBlurredAlertDialogCancel(BlurredColorPickerDialog.this);
                    }
                });
    

    and xml

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingBottom="5dp">
        <com.larswerkman.holocolorpicker.ColorPicker
            android:id="@+id/picker"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            app:color_wheel_radius="128dp"
            app:color_wheel_thickness="24dp"
            app:color_center_radius="54dp"
            app:color_center_halo_radius="60dp"
            app:color_pointer_radius="16dp"
            app:color_pointer_halo_radius="22dp"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            />
        <com.larswerkman.holocolorpicker.SVBar
            android:id="@+id/svbar"
            android:layout_width="200dp"
            android:layout_height="112dp"
            android:layout_gravity="center"
            android:layout_margin="5dip"
            android:layout_below="@+id/picker"
            android:layout_centerHorizontal="true"/>
    </RelativeLayout>
    

    What i'm doing wrong? Is it bug in lib?

    opened by gorbin 6
  • After rotating the device value of bar_orientation_horizontal is not respected

    After rotating the device value of bar_orientation_horizontal is not respected

    If you set bar_orientation_horizontal for portrait and unset it for landscape, after you rotate the device, you get the same value as in previously used layout.

    This is how it was coded as part of #29, so I'm bringing here @tonyr59h to discuss it.

    I fixed it by removing orientation related code from saturation and value bars from onSaveInstanceState and onRestoreInstanceState.

    opened by mg6maciej 6
  • No way to set Gray Color

    No way to set Gray Color

    As far as I can see, there is no way to choose gray colors with this Color Picker, such as #B5B5B5 or #222222. If there is a was to do this, and a obvious one at that, I apologies for the submitting of this issue.

    I Really love this spinner's design, but I hardly consider using an other one instead, due to this issue.

    opened by Harteg 6
  • getColor doesn't work after setColor

    getColor doesn't work after setColor

    Hi all,

    when I try to set the color of the picker through a call to setColor, it works. But immediatily after, if I call getColor it returns another color which is always the full green one. Any update to fix this problem?

    opened by edoardotognoni 5
  • Color selection to string

    Color selection to string

    Not really an issue. I need to be able to send the selected color as a string to a database. Is it possible to convert the selection to a string? If it is, how would I go about doing that? I'm very new to this library so any help in the right direction would be great. Thank you.

    opened by power7714 4
  • Fire onColorChanged(...) event only once

    Fire onColorChanged(...) event only once

    Before this change, the onColorChanged(...) event was fired hundreds of times while moving the color wheel. Now it is fired only once after the user released the color wheel again.

    opened by ocram 4
  • Make HoloColorPicker available as a preference

    Make HoloColorPicker available as a preference

    I'm looking for a good color picker to use in the preferences of my app. HoloColorPicker looks like a nice library. Any plans to create a "HoloColorPickerPreference"?

    opened by blurpy 4
  • onChangeListener executes several times with different values when bars are involved

    onChangeListener executes several times with different values when bars are involved

    When I combine the picker with ValueBar and SaturationBar, the onChangeListener in ColorPicker.setNewCenterColor() is fired several times. Reason is that each bar does its color calculation on the center circle color value and sets its value to the newly calculated one.

    So, having a ValueBar and a SaturationBar fires three events in case I rotate the Picker:

    • on Picker Rotation complete (fully saturated and bright value)
    • on ValueBar color calcuation complete (value dimished with brightness)
    • on SaturationBar color calcuation complete (value desaturated)

    I have no idea how to link color calculation correctly, so my quick and dirty hack is to introduce a boolean mEventMode with appropriate getter/setter and disable the firing of the Listener from each bar (touchEvent):

    mPicker.setEventModeDisabled(true);
    mPicker.setNewCenterColor(mColor);
    mPicker.setEventModeDisabled(false);
    mPicker.changeValueBarColor(mColor);
    mPicker.changeOpacityBarColor(mColor);
    

    Since this is dirty, I'll refrain from committing anything :)

    Imo, synching color calculation and correct Bar isolation from colorPicker requires major rework, on the bright side, nice UI component...

    opened by nouser2013 4
  • Colors are not always correct

    Colors are not always correct

    Hi. I really like your color picker and want to use it in my app. However I found two problems with the color.

    1. When you pick a color with a high saturate or value and then do a picker.setColor(picker.getColor()), the color changes a bit. I thought, this should not happen, so I looked around in the code and found, that the normalizeColor(int) method is a too complicated. I think to get an accurate value for the normColor variable, one could use the following lines, which solve the problem for me:

      Color.colorToHSV(color, mHSV);
      mHSV[1] = 1f;
      mHSV[2] = 1f;
      int normColor = Color.HSVToColor(Color.alpha(color), mHSV);
      
    2. When you do a picker.setColor(Color.BLACK), the SVBar slider is set to white (saturate=0). I solved this by changing the if-block in the setColor(int) method of the ColorPicker:

      if (mHSV[1] < mHSV[2]) {
          mSVbar.setSaturation(mHSV[1]);
      } else {
          SVbar.setValue(mHSV[2]);
      }
      

    I know, I could do a pull request with these changed, but I certainly don't know how to do this, so here is an issue for it. I hope it helps. Keep up the very good work.

    opened by frigus02 4
  • Make focusable as for TV layer

    Make focusable as for TV layer

    Hello and thank you for this wonderful library. But, I want to ask you to make it focusable for using for example from DPAD navigation as for TV (KeyListener). Is it possible?

    opened by 8o8aua 0
  • This library has a lot of bugs but...

    This library has a lot of bugs but...

    If someone still have interests to this project you can take a look to my "not exactly fork". I just take sikaiser fork, fixed a couple of bugs and adapted this view to use with androidx:preference and google.material libraries. So in my "fork" you can use ColorPicker as simple view or already prepared DialogPreference. Here is the link

    opened by 7Koston 0
  • [Fix] Change README to markdown form

    [Fix] Change README to markdown form

    Nice to meet you. I am a Japanese Developer and I prefer your library. I am always grateful for your help.

    The way to write your README was a bit different, so I edited it. Please merge if you do not mind. Thank you for your consideration.

    opened by yosh1 0
  • Fix OpacityBar(ValueBara etc) touch handle bug

    Fix OpacityBar(ValueBara etc) touch handle bug

    Thank for your library. I use your library in my app and found the touch event handle has bug.
    When user click screen, touch event flow is down -> up(without move event in some phone), OpacityBar(ValueBara etc)'s color is change, but relative ColorPicker not change color.
    This pr for fix this bug.
    BTW, I upgrade build tools chain and fix type in setting.gradle.

    opened by knownit 5
  • HoloPicker Size parameters not in documentation

    HoloPicker Size parameters not in documentation

    Creating an App using 2 Holopickers, i accidentally stumbled upon some resizers for the picker (in another issue about the SVBar) Being :

                app:color_center_halo_radius="40dp"
                app:color_center_radius="30dp"
                app:color_pointer_halo_radius="22dp"
                app:color_pointer_radius="16dp"
                app:color_wheel_radius="70dp"
                app:color_wheel_thickness="24dp"
    

    for instance then i started looking at for info on how to do something similar for the 'bars' but google didn't find an answer. but somehow i managed to find :

                app:bar_length="140dp"
                app:bar_pointer_halo_radius="14dp"
                app:bar_pointer_radius="10dp"
                app:bar_thickness="8dp"
    

    i mus have been looking through the source-code, but that is a tad tricky for me, Java is not my first language and AS is taking up so much memory that many times webpages get put in the pagefile on the harddrive, which makes it all rather slow. Anyway the question i did not find any answer to is how can i remove the margins from the picker (or make them smaller) so that i can put them a little closer together while using "Constraint-layout". Basically anyway are there any other parameters i can modify.

    opened by devarishi7 0
  • Migrate to GradleMavenPush https://github.com/Vorlonsoft/GradleMavenPush

    Migrate to GradleMavenPush https://github.com/Vorlonsoft/GradleMavenPush

    Migrate to GradleMavenPush https://github.com/Vorlonsoft/GradleMavenPush

    Reasons:

    • Old plugin don't have updates for 4 years
    • Better javadocs generation
    • Better pom file generation
    • Smaller gradle.properties
    • You can easy migrate from Maven Central to JCenter by adding to your code IS_JCENTER = true only and register at https://bintray.com/bintray/jcenter
    opened by AlexanderLS 0
Owner
Lars Werkman
Lars Werkman
🎨 Android colorpicker for getting colors from any images by tapping on the desired color.

ColorPickerView ?? ColorPickerView implements getting HSV colors, ARGB values, Hex color codes from any image drawables or your gallery pictures by ta

Jaewoong Eum 1.3k Dec 26, 2022
Aether - anti-aliased UI engine designed for Minecraft, and general LWJGL

README WIP SOME THINGS MIGHT BE INACCURATE Aether UI Aether is anti-aliased UI engine designed for Minecraft, and general LWJGL. It is compatible with

Prism Client 35 Nov 12, 2022
The ShowcaseView library is designed to highlight and showcase specific parts of apps to the user with an attractive and flat overlay.

The ShowcaseView library is designed to highlight and showcase specific parts of apps to the user with an attractive and flat overlay.

Mohammad Reza Eram 484 Dec 26, 2022
Android library used to create an awesome Android UI based on a draggable element similar to the last YouTube graphic component.

Draggable Panel DEPRECATED. This project is not maintained anymore. Draggable Panel is an Android library created to build a draggable user interface

Pedro Vicente Gómez Sánchez 3k Dec 6, 2022
TourGuide is an Android library that aims to provide an easy way to add pointers with animations over a desired Android View

TourGuide TourGuide is an Android library. It lets you add pointer, overlay and tooltip easily, guiding users on how to use your app. Refer to the exa

Tan Jun Rong 2.6k Jan 5, 2023
Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your development.

Bubbles for Android Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your

Txus Ballesteros 1.5k Jan 2, 2023
View that imitates Ripple Effect on click which was introduced in Android L (for Android 2.3+)

RippleView View that imitates Ripple Effect on click which was introduced in Android L. Usage For a working implementation, Have a look at the Sample

Muthuramakrishnan Viswanathan 1.2k Dec 30, 2022
A new canvas drawing library for Android. Aims to be the Fabric.js for Android. Supports text, images, and hand/stylus drawing input. The library has a website and API docs, check it out

FabricView - A new canvas drawing library for Android. The library was born as part of a project in SD Hacks (www.sdhacks.io) on October 3rd. It is cu

Antwan Gaggi 1k Dec 13, 2022
MarkdownView is an Android webview with the capablity of loading Markdown text or file and display it as HTML, it uses MarkdownJ and extends Android webview.

About MarkdownView (Markdown For Android) is an Android library that helps you display Markdown text or files (local/remote) as formatted HTML, and st

Feras Alnatsheh 1k Dec 20, 2022
SwipeBack for Android Activities to do pretty the same as the android "back-button" will do, but in a really intuitive way by using a swipe gesture

SwipeBack SwipeBack is for Android Activities to do pretty the same as the android "back-button" will do, but in a really intuitive way by using a swi

Hannes Dorfmann 697 Dec 14, 2022
A backport of the SwitchPreference component that was introduced on Android 4 (ICS / level 14). This port works on Android 2.1+ (Eclair MR1 / level 7).

Android Switch Preference Backport A backport of the SwitchPreference component that was introduced on Android 4 (ICS / level 14). This port works on

Benoit Lubek 498 Dec 29, 2022
Wizard Pager is a library that provides an example implementation of a Wizard UI on Android, it's based of Roman Nurik's wizard pager (https://github.com/romannurik/android-wizardpager)

Wizard Pager Wizard Pager is a library that provides an example implementation of a Wizard UI on Android, it's based of Roman Nurik's wizard pager (ht

Julián Suárez 520 Nov 11, 2022
Make your native android Toasts Fancy. A library that takes the standard Android toast to the next level with a variety of styling options. Style your toast from code.

FancyToast-Android Prerequisites Add this in your root build.gradle file (not your module build.gradle file): allprojects { repositories { ... ma

Shashank Singhal 1.2k Dec 26, 2022
Make your native android Dialog Fancy. A library that takes the standard Android Dialog to the next level with a variety of styling options. Style your dialog from code.

FancyAlertDialog-Android Prerequisites Add this in your root build.gradle file (not your module build.gradle file): allprojects { repositories { ..

Shashank Singhal 350 Dec 9, 2022
Xamarin.Android provides open-source bindings of the Android SDK for use with .NET managed languages such as C#

Xamarin.Android Xamarin.Android provides open-source bindings of the Android SDK for use with .NET managed languages such as C#. Build Status Platform

Xamarin 1.8k Jan 5, 2023
A Tinder-like Android library to create the swipe cards effect. You can swipe left or right to like or dislike the content.

Swipecards Travis master: A Tinder-like cards effect as of August 2014. You can swipe left or right to like or dislike the content. The library create

Dionysis Lorentzos 2.3k Dec 9, 2022
Bootstrap style widgets for Android, with Glyph Icons

Android-Bootstrap Android Bootstrap is an Android library which provides custom views styled according to the Twitter Bootstrap Specification. This al

Bearded Hen 7.3k Jan 3, 2023
[] A fast PDF reader component for Android development

This project is no longer maintained. You can find a good replacement here, which is a fork relying on Pdfium instead of Vudroid/MuPDF for decoding PD

Joan Zapata 2.8k Dec 16, 2022