Preview:
const colors = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet'];
//for...of - loop
const spans = document.querySelectorAll("span");
let count = 0
for (let span of spans){
    span.style.color = colors[count]
    count++
}
//alternative:
//for-loop
const spans = document.querySelectorAll('span'); 
for(let i =0; i< colors.length; i++){
    spans[i].style.color = colors[i];
} 

downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter