use float for opacity and color

and fix compilation error