SVG array random color fill

HTML
<svg height="210" width="210"> <polygon points="100,10 40,198 190,78 10,78 160,198"/> </svg>
CSS
svg { fill: #1abc9c; transition: fill 1.5s ease; -webkit-transition: fill 1.5s ease; }
JAVASCRIPT
var select = function(s) { return document.querySelector(s); }; var svg = select('svg'); var time = 900; setInterval( function () { var colors = ['#1abc9c', '#2ecc71', '#3498db', '#9b59b6', '#34495e'] var rand = Math.floor(Math.random() * colors.length); svg.style.fill = colors[rand]; }, time);
Expand for more options Login