withAlpha
Returns this color with its alpha channel replaced by alpha, in 0.0..1.0, and red, green and blue unchanged. color.withAlpha(0f) is the color fully transparent, which is what a fade out ends on.
Throws
if alpha is outside 0.0..1.0.
Samples
val orange = Color(red = 1f, green = 0.5f, blue = 0f)
assertPrints(orange.withAlpha(0f), "Color(#ff800000)")
assertPrints(Color.TRANSPARENT, "Color(#00000000)")Content copied to clipboard