Yes I see now. It should be instance.material=[r,g,b] not instance.material.color=[r,g,b] which I thought is what TIG meant in his original suggestions.
After making that change everything seems to be working. I have attached a copy if anyone else is interested in trying it out.