I have RGB code for a color. For example Gray color (118,118,118). How can I use it in setPixel() function? Because setPixel() function wants argb for color.
int color = Color.argb(255, 118, 118, 188);
if you want full opacity.
The first (a) value represents the Alpha channel, or in plain language: the transparency. (How much you can see through this colour, to the images behind it)
The value is one byte, so acceptable values range from 0 to 255.
As per the answer above, a value of 255 means your colour will be completely opaque (solid).
A value of 128 will give you 50% transparency.
A value of 0 will make your object completely invisible, regardless of your colour value, but the object still exists, like a sheet of perfectly clear glass, if you allow the analogy.
This can be useful for e.g secret/hidden/invisible buttons, creating easter eggs, or specific cases of UI tuning.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With