检查更新的小提琴http://jsfiddle.net/0xdwhsnc/
你错过了索引,而不是颜色使用颜色[i]
for (var i = 0; i 更具体:`colors [i%colors.length]`