Skip to content
Simple color picker library for Android
Branch: master
Clone or download
Latest commit ac37961 Feb 10, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea Improve slider tracking. Feb 9, 2019
app Update demo. Feb 10, 2019
colorslider Update version. Feb 9, 2019
gradle/wrapper Update preview. Feb 9, 2019
res Update screenshot in README. Jan 13, 2018
.gitignore Update gradle. Jan 11, 2019
LICENSE Create LICENSE Jun 11, 2017
README.md Update README.md Feb 10, 2019
build.gradle Update preview. Feb 9, 2019
gradle.properties Init commit. Jun 11, 2017
gradlew Init commit. Jun 11, 2017
gradlew.bat Init commit. Jun 11, 2017
settings.gradle Init commit. Jun 11, 2017

README.md

ColorSlider

Simple color picker library for Android

Screenshot

Screenshot

Sample APP

Download

Google Play

Download

Download latest version with Gradle:

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

dependencies {
    implementation 'com.github.naz013:ColorSlider:1.0.5'
}

Usage

Default (Material colors picker):

<com.github.naz013.colorslider.ColorSlider
        android:id="@+id/color_slider"
        android:layout_width="match_parent"
        android:layout_height="36dp" />

Gradient (Params: cs_from_color, cs_to_color, cs_steps): via XML:

<com.github.naz013.colorslider.ColorSlider
        android:id="@+id/color_slider"
        android:layout_width="match_parent"
        app:cs_from_color="#F44336"
        app:cs_steps="500"
        app:cs_to_color="#40F44336"
        android:layout_height="36dp" />

in code:

colorSlider.setGradient(@ColorInt int fromColor, @ColorInt int toColor, int steps)

Gradient from array of colors: in code:

colorSlider.setGradient(@ColorInt int[] colors, int steps)

Array of color resources (Params: cs_colors): via XML:

<com.github.naz013.colorslider.ColorSlider
        android:id="@+id/color_slider"
        android:layout_width="match_parent"
        app:cs_colors="@array/colors"
        android:layout_height="36dp" />

in code:

colorSlider.setColors(@ColorInt int[] colors)

String array of hex colors (Params: cs_hex_colors): via XML:

<com.github.naz013.colorslider.ColorSlider
        android:id="@+id/color_slider"
        android:layout_width="match_parent"
        app:cs_hex_colors="@array/hex_colors"
        android:layout_height="36dp" />

in code:

colorSlider.setHexColors(String[] hexColors)

Also you can set listener for color picker:

colorSlider.setListener(new ColorSlider.OnColorSelectedListener() {
        @Override
        public void onColorChanged(int position, int color) {
            updateView(color);
        }
    })

License

Copyright 2019 Nazar Suhovich

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.
You can’t perform that action at this time.