Color picker view library provides selection of a color via human-perceivable form HSB using three selectors: hue, saturation and brightness. The code is very simple and small (on August 2020).
Concept of color picker dialog with some hints:
- Initial and current colors are placed side-by-side, so the difference can be clearly visible
- Numbers behind each component provide the ability to "recreate" the color later
- No puzzles which color you get with HSB model
Live screenshots:
Dark theme | Light theme with transparency |
---|---|
Action demo:
Slider stripes and manipulator dots adapt their color on moving other sliders.
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
implementation 'com.github.applikationsprogramvara:ColorPicker:1.0.1'
}
Color picker is ready to use out of the box with several lines added to your code.
As a dialog:
new ColorPickerDialog(this)
.setTitle("Color picker dialog")
.setInitialParameters( initalColor, false)
.setPositiveButton("OK", color -> {
// process the new color
})
.setNegativeButton("Cancel", null)
.show();
As a view in XML:
<com.applikationsprogramvara.colorpicker.ColorPickerSlidersView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:transparency="false"
app:initialColor="#9B3232"
/>
- Manupulator theming and contrast on low brightness
- Alternative one-tap palette with all possible colors
- Landscape mode
- Digital input and copy/paste HTML-colors
- Preference
- Get rid of jumping color patches due to extra digit