Last active
October 8, 2024 03:22
-
-
Save gkucmierz/48d556ac809bba3355df4a214130c046 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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