Skip to content

Pritam307/ColorPickerLibrary

Repository files navigation

ColorPickerLibrary

Alt text

Alt text

For Gradle: Add it in your root build.gradle at the end of repositories:

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

Add the dependency:

dependencies {

        compile 'com.github.Pritam307:ColorPickerLibrary:master-SNAPSHOT'
}

For Maven: Add the JitPack repository to your build file:

<repositories>
	<repository>
	    <id>jitpack.io</id>
	    <url>https://jitpack.io</url>
	</repository>
</repositories>

Add the dependency:

<dependency>
    <groupId>com.github.Pritam307</groupId>
    <artifactId>ColorPickerLibrary</artifactId>
    <version>master-SNAPSHOT</version>
</dependency>

Use this in the layout.xml file:

<com.pritamkundilya.colorpickerlibrary_pk.ColorPickerView
    android:layout_width="300dp"
    android:id="@+id/picker"
    android:layout_height="300dp"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="35dp" />

<com.pritamkundilya.colorpickerlibrary_pk.ColorAlpha
    android:id="@+id/alphabar"
    android:max="255"
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:layout_margin="20dp"
    android:layout_below="@+id/picker"
    android:layout_centerHorizontal="true" />

And this lines of code in activity:

     GetColor color;
    ColorPickerView view;
    ColorAlpha seekbar;
    ArrayList<Integer> val=new ArrayList<>();
    view= (ColorPickerView) findViewById(R.id.picker);
    seekbar= (ColorAlpha) findViewById(R.id.alphabar);
    color=new GetColor(getApplicationContext(),view,seekbar);
    color.extract();
 
 public void onClickColor(View v)
{
    val=color.getRGB();
    Toast.makeText(getApplicationContext(),          "Alpha:"+val.get(0)+"Red:"+val.get(1)+"Green:"+val.get(2)+"Blue:"+val.get(3),Toast.LENGTH_LONG).show();
}

....

}

LICENSE

Copyright (C) 2017 Pritam Kundilya

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.

Releases

No releases published

Packages

No packages published

Languages