I am drawing a rectangle with a linear gradient as background color on a Compose Canvas using,
drawRect(brush = Brush.horizontalGradient(),topLeft = ,size = ) and it looks like below,

I want to pick the color code from this gradient for an X-coordinate value on the gradient. How can I do that? For example, from the above screenshot the color at position x = 0 should give me color code of Green.