Convert the gradient color to the drawable's type before using it. (manually cherry-picked from 15fd0874)