How to make smooth transition of color

Hi,
I am working on rendering gradient colors. There are multiple colors. These colors are shuffled and rendered again on sprite.
How can we make color transition smooth.
Attached current implementation of colors transition and code for updating gradient colors


Screenshot 2022-05-05 at 10.13.59 AM

is there any way to achieve smooth transition?
Thanks

Hi This might help you: Color gradient algorithm - Stack Overflow

Thanks for the replay @AndyTian ,but it generates smooth gradient between two colors.
but i need to change gradient colors smoothly during runtime.
for example -There are 3 set of color, which rendered gradient like first color at bottom left(BL) ,another at bottom right(BR), and one more at top left(TL).I need to change its place (like BL->BR, BR->TL ) Smoothly. is that possible?

Thanks,