I am generating random color with JavaScript
. How do I know if the color produced is dark/light?
My JavaScript
codes I use
btn.addEventListener('click', e => {
const R = Math.floor(Math.random() * 256);
const G = Math.floor(Math.random() * 256);
const B = Math.floor(Math.random() * 256);
body.style.backgroundColor = `rgb(${R}, ${G}, ${B})`;
colorText.innerText = `R: ${R} \nG: ${G} \nB: ${B}`;
});