I usually mix all the colors that I will need at the start of my decorating. Then, when it is time to put them in the decorating bag, I stir them again.
The spots of color don't happen all the time. I had a container of Wilton purple that had spotting problems every time I used it. I decided it was old and got another container and the problems were gone.
Sometimes it happens, sometimes it doesn't. Look closely at the top of this cake, above the "om" in my watermark. The white spots are what I think is undissolved salt. Now I put my salt in with the liquids not the dry so it has time to dissolve.
Here is a cake with red dots in my pink icing.
I'm always learning.