lerp

fun Color.lerp(to: Color, t: Float): Color(source)

Returns the color t of the way from this color to to, blending each channel, alpha included, on its own: this color at 0, to at 1. t is clamped to 0.0..1.0, because a blend past either end could leave a channel's range.

Samples

assertPrints(Color.BLACK.lerp(Color.WHITE, 0.5f), "Color(#808080ff)")
assertPrints(Color.BLACK.lerp(Color.WHITE, 2f), "Color(#ffffffff)")