d.onclick = function click21() { if(event.ctrlKey) { d.style.background='#ccc'; } else { d.style.background='#6492cb';} } The color when you press CTRL + click changes to # ССС. How to make it so that when you press CTRL + click, the color changes to #CCC if you press CTRL + click again, then from #CCC to #DDD and so for example, 5 colors prepared in advance