JSFiddle - React, Tailwind, and code Playground

HTML

<p id="foo1">Some text</p>
<p id="foo2">Some text</p>
<p id="foo3">Some text</p>

JavaScript

function flash(el, c1, c2) {
    var text = document.getElementById(el);
    text.style.color = (text.style.color == c2) ? c1 : c2;
}
var clr1 = setInterval(function() {
    flash('foo1', 'gray', 'red')
}, 1000);
var clr2 = setInterval(function() {
    flash('foo2', 'gray', 'blue')
}, 1000);
var clr3 = setInterval(function() {
    flash('foo3', 'gray', 'green')
}, 1000);