check colorIndex for null, not truthiness (0 is valid)