| 14 | |
| 15 | //Update the UI |
| 16 | function updateUI(){ |
| 17 | infoElem.remove(); |
| 18 | |
| 19 | color1Elem.innerText = getHEX(); |
| 20 | color2Elem.innerText = getHEX(); |
| 21 | |
| 22 | color1Elem.style.background = color1Elem.innerText; |
| 23 | color2Elem.style.background = color2Elem.innerText; |
| 24 | |
| 25 | codeElem.innerText = `background: linear-gradient(90deg, ${color1Elem.innerText}, ${color2Elem.innerText});`; |
| 26 | document.body.style.background = `linear-gradient(90deg, ${color1Elem.innerText}, ${color2Elem.innerText})`; |
| 27 | } |
| 28 | |
| 29 | //when user clicks SPACE or the arrow, then UpdateUI |
| 30 | |