Update gradient.class.js

Fixed some errors introduced with previous commit.
Added correct alpha channel management.
Is this `color` still needed? Confusing to overwrite variable. I'd rather call it `colorInRgb` or smth like that.