i create time using tolocalString() and then i use this code to change the color every sec but it work only last color not for all

i create time using tolocalString() and then i use this code to change the color every sec but it work only last color not for all

var time=document.getElementById("time");


setInterval(function(){
    var da=new Date();
var ti=da.toLocaleTimeString();
// console.log("yes");
time.innerHTML=ti;
},1000);

setInterval(function(){
var arr=["red","blue","green"];
 var i=Math.floor(Math.random() * 2) + 1;
//  console.log(i);
    time.style.color=time.classList.add(arr[i]);
    console.log(i);

},1000);