blocks coloring like in game The Stack?

how to coloring blocks like in game “The stack”?

Color.Lerp will interpolate between two colors with a value between 0 to 1. Have a script that stores the two colors and increase the value every time a new block is created.