New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to change ColorBar color on new colorSeeds #35
Comments
Ahh nevermind, I found a tutorial a minute after sending this Issue: https://www.geeksforgeeks.org/how-to-add-colorseekbar-in-android/ Great stuff btw! PS. I tried adding the stuff from the tutorial and it works, but I was wondering if you could include the showAlphaBar option back in the latest version? |
@EddieXu123 showAlphaBar was removed in version 2.0.*, please use AlphaSeekbar to control the alpha channel value, use alphaSeekBar.setOnAlphaChangeListener to watch value changed. <com.rtugeek.android.colorseekbar.AlphaSeekBar
android:id="@+id/alphaSeekBar"
android:layout_width="match_parent"
android:layout_height="wrap_content" /> If you want to merge AlphaSeekBar's alpha into ColorSeekBar's color, use this: int color = colorSeekBar.getColor()
int alpha = alphaSeekBar.getAlphaValue()
Color.argb(alpha, Color.red(color), Color.green(color), Color.blue(color)) /**
* if you use Kotlin, this extension function may help
* mix alpha value (0-255) into current color
*/
fun Int.mixAlpha(@IntRange(from = 0, to = 255) alpha: Int): Int {
return Color.argb(alpha, Color.red(this), Color.green(this), Color.blue(this))
} |
Thank you! I was also wondering, for now the .getColor() of the bar seems to return an integer in the negatives. I was just wondering how you would transfer this number to hsv? Or if not hsv RGB? Thanks! |
val hsv = FloatArray(3)
Color.colorToHSV(colorInt,hsv)
//hsv[0] is Hue \([0..360[\)
//hsv[1] is Saturation \([0...1]\)
//hsv[2] is Value \([0...1]\)
// hsv to color int
Color.HSVToColor(hsv) |
Thank you! Sorry, I'm really new to Android development so I just had one last question: If I want to add another seekbar to change the brightness of my view (using a ColorMatrixColorFilter), I was wondering how to go about that? This is what I'm doing so far:
And then when changing the brightness slider:
(Assuming the code is correct -> I did some reformatting, just trying to figure out how to get my ImageView to remain the same saturation_seekbar color while changing the brightness using that ColorMatrix). Thank you so much for all your help! |
https://stackoverflow.com/a/9226771/4639921 |
Got it, thank you so much! It works now after using a GradientDrawable and that helper function :) |
Hi there! I was trying to build an app with two ColorSeekBars - one to control the hue of my view and one to control the saturation. When I change my hue colorSeekBar, the colorSeeds of my saturation colorSeekBar change to (Color.WHITE, hueSeekBar.getColor()). This works well, but when I try dragging the saturationSeekBar, the color of the thumb remains unchanged (the original value). How would I go about doing this? Thank you!
The text was updated successfully, but these errors were encountered: