JSFiddle - React, Tailwind, and code Playground
HTML
<input id="color" type="text" onchange="changeBackground(this);" />
<br />
<span id="coltext">This text should have the same color as you put in the text box</span>
JavaScript
function changeBackground(obj) {
document.getElementById("coltext").style.color = obj.value;
}