Skip to content

Instantly share code, notes, and snippets.

@gkucmierz
Last active October 8, 2024 03:22
Show Gist options
  • Save gkucmierz/48d556ac809bba3355df4a214130c046 to your computer and use it in GitHub Desktop.
Save gkucmierz/48d556ac809bba3355df4a214130c046 to your computer and use it in GitHub Desktop.
// this code pasted on Project Euler console site shows difficulty of tasks using colors
const round = n => Math.round(n);
[...document.querySelectorAll('.smaller')].forEach(e=>{;
const diff = (+e.innerHTML.match(/\d{1,3}/)[0]) / 100 * 255;
const color = `rgba(${diff},${255-diff},0,1)`;
e.parentNode.parentNode.parentNode.style.backgroundColor = color;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment