remove duplicate code
add support for more colors in the gradient