You basically have 2 options:
1. Manually recolor each sprite in Photoshop or something, then save these as individual animations for each unit.
PROS:
-Works everywhere.
-Little negative performance impact (provided you are within memory limits).
CONS:
-Extremely laborious.
-More laborious the more colors you want
-Not very maintainable
-Uses up a lot of graphics memory.
2. Use a WebGL effect (Adjust HSL or Tint)
PROS:
-Easy to do
-Uses little graphics memory
-Very maintainable
-More color choices than you will ever need
CONS:
-Doesn't work everywhere, only works where webGL is supported.
-Shader effects are hard on the GPU, especially at high resolutions
I would roll with the second option, but if mobile development is important to you that may not be an option (although option 1 won't be very viable either as phones have very limited graphics memory).