Or you can put this in array and remember the index of the color.
<input type=button data-colors="red green blue yellow gold" daya-index=0 style="color:red" onclick='pricessColor(this)'>
function pricessColor(me) {
let index=me.getAttribute("data-index")+1;
let colorArr=me.getAttribute("data-colors").split(" ");
if(colorArr.length<=index){
index=0
}
me.style.color=colorArr[index];
me.setAttribute("data-index", index);
}
I thought it would be fun.