Rather than set styles, set a class name based on color index.

indentation is off here