side-codes / android-color-picker Goto Github PK
View Code? Open in Web Editor NEWColor picker library for Android
Home Page: https://side-codes.github.io/andColorPicker/
License: Apache License 2.0
Color picker library for Android
Home Page: https://side-codes.github.io/andColorPicker/
License: Apache License 2.0
Make thumb state transitions animated
I set a listener for the hue seekbar, then I wanted to get the Hex value for the picked color, so after some searching, I managed to write an extension function to accomplish just that, but it didn't work ๐
fun IntegerHSLColor.toHex(): String {
val color = floatArrayOf(floatH, floatS / 100, floatL / 100)
val intColor = HSLToColor(color)
val red: Int = Color.red(intColor)
val green: Int = Color.green(intColor)
val blue: Int = Color.blue(intColor)
return String.format("#%02x%02x%02x", red, green, blue)
}
colorSeekbar.addListener(object :
ColorSeekBar.OnColorPickListener<ColorSeekBar<IntegerHSLColor>, IntegerHSLColor> {
override fun onColorPicked(
picker: ColorSeekBar<IntegerHSLColor>,
color: IntegerHSLColor,
value: Int,
fromUser: Boolean
) {
val colorHex = color.toHex()
"onColorPicked colorHex = $colorHex".log()
}
override fun onColorChanged(
picker: ColorSeekBar<IntegerHSLColor>,
color: IntegerHSLColor,
value: Int
) {}
override fun onColorPicking(
picker: ColorSeekBar<IntegerHSLColor>,
color: IntegerHSLColor,
value: Int,
fromUser: Boolean
) {}
})
No matter what color I choose, it always logs this value :
/>>: onColorPicked colorHex = #010101
What am I doing wrong? is there a more straightforward way to get the hex value?
Implement SeekBar / bridge responsible for the alpha component selection
I'm using Jetpack Compose, but the library has no native support of Compose so I have to use AndroidView() to integrate this library to composable. It would be wonderful to add native support for Compose, or at least write a guide on how to use this library correctly through AndroidView
Hey man, cool work you've done here!
Would it be possible to display the picker vertically ?
Hello developer.
in ColorPickerSeekBars not supported (OnSeekBarChangeListener)
throw IllegalStateException("Custom OnSeekBarChangeListener not supported yet")
Implement RGB seek bars, add RGB Alpha support and all the related ecosystem components like converters, models, samples, etc.
Is your feature request related to a problem? Please describe.
Current minimum SDK is set to API 21. For example my app supports back to API 19. I can't use this library :(
Describe the solution you'd like
Support lower API versions.
When setting a group color (when the group has HUE seekbar, lightness seekbar and saturation seekbar), the color gets changed to another color very close to the original, altering the colorInt
when recovering it from coloIntegerHSlColor.toColorInt()
This one is confusing me.. I was using the color picker just fine yesterday and now today the project is failing to build with the compiler error:
/Users/jpage/working/projects/hubitat-dashboard/app/src/main/java/com/jpage4500/hubitat/ui/fragments/DashboardFragment.java:654: error: cannot access KMappedMarker
group.registerPicker(dialogLayout.colorSeekBar);
^
class file for kotlin.jvm.internal.markers.KMappedMarker not found
It's complaining about the lines here:
PickerGroup<IntegerHSLColor> group = new PickerGroup<>();
group.registerPicker(dialogLayout.colorSeekBar);
group.registerPicker(dialogLayout.saturationSeekBar);
group.registerPicker(dialogLayout.lightnessSeekBar);
I imagine this isn't related to your library since it was building just fine yesterday. But, I can't figure out what changed or why it's now all of the sudden failing to compile so I figured someone here might have an idea why
<dimen name="acp_seek_progress_corner_radius">4dp</dimen>
<dimen name="acp_seek_progress_padding">5dp</dimen>
<dimen name="acp_seek_progress_height">10dp</dimen>
<dimen name="acp_thumb_stroke_width">4dp</dimen>
<dimen name="acp_thumb_size_full">20dp</dimen>
<dimen name="acp_thumb_size_default">24dp</dimen>
<dimen name="acp_thumb_ripple_radius">15dp</dimen>
The value defined above can be set in the code
SeekBar can customize the color array
Describe the bug
When I want to add the view to my main activity.xml I get an inflate error.
To Reproduce
Steps to reproduce the behavior:
implementation "codes.side:andcolorpicker:0.5.0"
to app/build.gradle<codes.side.andcolorpicker.hsl.HSLColorPickerSeekBar android:layout_width="200dp" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" android:layout_height="wrap_content" app:hslMode="hue" />
to main_activity.xmlExpected behavior
It should run and the slider should be visible
Extra information
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable.mutate()' on a null object reference at codes.side.andcolorpicker.view.picker.ColorSeekBar.setupBackground(ColorSeekBar.kt:121) at codes.side.andcolorpicker.view.picker.ColorSeekBar.<init>(ColorSeekBar.kt:106) 2021-04-06 12:16:53.779 24098-24098/com.prowise.service.pronote_2021 E/AndroidRuntime: at codes.side.andcolorpicker.view.picker.GradientColorSeekBar.<init>(GradientColorSeekBar.kt:16) at codes.side.andcolorpicker.hsl.HSLColorPickerSeekBar.<init>(HSLColorPickerSeekBar.kt:27) at codes.side.andcolorpicker.hsl.HSLColorPickerSeekBar.<init>(HSLColorPickerSeekBar.kt:25) at codes.side.andcolorpicker.hsl.HSLColorPickerSeekBar.<init>(Unknown Source:6) ... 30 more
Please consider including White color at the start of the Hue palette and Black at the end of it, so all the colors can be chosen from the Hue palette without need to insert the second Intensity palette.
Describe the bug
Error in Readme. Line 90 object : HSLColorPickerSeekBar.DefaultOnColorPickListener()
As per your Example app/src/main/java/codes/side/andcolorpicker/app/fragment/HSLSeekBarGithubSampleFragment.kt
Line Should be : object : OnIntegerHSLColorPickListener()
When choosing a color via the 3 bars (H,S,L), I retrieve the current IntegerHSLColor and then use this to update each of the bars via setPickedColor(). Hue changes the S & L bar colors, but Saturation changes have no effect. So choosing zero for Saturation to give black <-> white should change the L bar to be just this, i.e. black on the left to white on the right. Instead it stays at whatever color the H bar is set to.
This doesn't affect the returned values, just the colour displayed on the L bar.
Apart from that, this library rocks. Many thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.