Giter VIP home page Giter VIP logo

colorslider's Introduction

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.6'
}

AndroidX version:

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

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.

colorslider's People

Contributors

howardocasta avatar naz013 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

colorslider's Issues

Ability to clear selection

I use custom color selection picker alongside ColorSlider and after I select a color outside the predefined set, selection on the UI is active on one of the colors.

2022-07-04 18 32 58

android studio 3.6 beta 1

I don't know if it is an issue with android studio, but I have just downloaded android studio 3.6 beta 1 and the sync fails for some reason. Could you check if the problem is with the library.

ERROR: Failed to resolve: com.github.naz013:ColorSlider:1.0.5
Show in Project Structure dialog
Affected Modules: app

I don't know if it's important, but it's not the only library with this error. Here is another one, however all the other ones seem to work perfectly fine:

ERROR: Failed to resolve: com.github.Ferfalk:SimpleSearchView:0.1.4
Show in Project Structure dialog
Affected Modules: app

Kotlin incompatibility

in ColorSlider.OnColorSelectedListener should not be necessary to override invoke(int ,int) method, especially with arguments.

with a simple fix, you could not use the following workaround
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.