# ColorSeekBar **Repository Path**: rtugeek/ColorSeekBar ## Basic Information - **Project Name**: ColorSeekBar - **Description**: A colorful SeekBar for picking color - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2016-09-25 - **Last Updated**: 2024-11-30 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ![ColorSeekbar](https://github.com/Tobaloidee/ColorSeekBar/blob/master/logo/colorseekbar-02.png) ### ScreenShot: ![](https://github.com/rtugeek/ColorSeekBar/blob/master/screenshot/screenshot.gif) ### Attrs |attr|format|default| |---|:---|:---:| |colorSeeds|references|| |colorBarPosition|integer|0| |alphaBarPosition|integer|0| |maxPosition|integer|100| |bgColor|color|TRANSPARENT| |barHeight|dimension|2dp| |barMargin|dimension|5dp| |thumbHeight|dimension|30dp| |showAlphaBar|boolean|false| |isVertical|boolean|false| ### Gradle: ![Release](https://jitpack.io/v/rtugeek/colorseekbar.svg) ![API](https://img.shields.io/badge/API-14%2B-brightgreen.svg?style=flat) ![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-ColorSeekBar-green.svg?style=true) Step 1. Add the JitPack repository in your root build.gradle at the end of repositories: ``` allprojects { repositories { ... maven { url "https://jitpack.io" } } } ``` Step 2. Add the dependency ```  compile 'com.github.rtugeek:colorseekbar:1.7.3' ``` ## Usage XML ```xml ``` JAVA ```java  colorSeekBar.setMaxPosition(100); colorSeekBar.setColorSeeds(R.array.material_colors); // material_colors is defalut included in res/color,just use it. colorSeekBar.setColorBarPosition(10); //0 - maxValue colorSeekBar.setAlphaBarPosition(10); //0 - 255 colorSeekBar.setShowAlphaBar(true); colorSeekBar.setBarHeight(5); //5dpi colorSeekBar.setThumbHeight(30); //30dpi colorSeekBar.setBarMargin(10); //set the margin between colorBar and alphaBar 10dpi ``` Listener ```java colorSeekBar.setOnColorChangeListener(new ColorSeekBar.OnColorChangeListener() { @Override public void onColorChangeListener(int colorBarPosition, int alphaBarPosition, int color) { textView.setTextColor(color); //colorSeekBar.getAlphaValue(); } }); ``` ## Vertical Bar [BETA] ```xml ``` ![](https://github.com/rtugeek/ColorSeekBar/blob/master/screenshot/vertical.png) ## getColor() issue Render flow: 1.Activity->onCreate(); 2.Activity->onResume(); 3.ColorSeekBar->onMeasure(); 4.ColorSeekBar->onSizeChanged(); 5.ColorSeekBar->init(); 6.ColorSeekBar->onMeasure(); 7.ColorSeekBar->onDraw(); getColor()/getColors()/getColorIndexPosition() do not work correct until onDraw() method invoked. So, If you want to get color or something else form ColorSeekBar on Activity.onCreate() function, just do: ```java mColorSeekBar.setOnInitDoneListener(new ColorSeekBar.OnInitDoneListener() { @Override public void done() { mColorSeekBar.getColorIndexPosition(mColor); //mColorSeekBar.getColors(); //mColorSeekBar.getColor(); } }); ``` **Spread the word** ## License DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004 Copyright (C) 2004 Leon Fu Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed. DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. You just DO WHAT THE FUCK YOU WANT TO.