The coloring handling here seems completely wrong to me.  You need to follow the details laid out at https://developers.google.com/kml/documentation/kmlreference#color

I would write a couple of unit tests using IconStyle that just tests the different color modes to make sure they work as expected.  Let me know when you think you have color working.