Need help writing a javascript that would based on highest text value change the color of the box to yellow

Hi there,
here´s a new Version with coloring corresponding boxes with gradient, you asked for. You have to define the style of your choice in the Head-HTML, eg.:

<style>.mygradient {
background-image: repeating-linear-gradient(45deg, rgba(0,0,0,0.05) 0px, rgba(0,0,0,0.05) 2px,transparent 2px, transparent 4px),linear-gradient(90deg, rgb(29, 67, 158),rgb(219, 239, 242));
}</style>

Don´t forget to uncheck 'protect from external styles' in the document panel (or add an '!important' at the end of the style Definition)

image

Your script then would add the class 'mygradient' to the box, instead of setting its backgroundColor:

corrBox.classList.add ('mygradient');

Removing the class on init:

elm.classList.remove ('mygradient');

There´s a great thread about how to use gradients in Hype which also links to a very helpful website. It offers a bunch of gradient styles for your personal use.

recolorOnSortGradient.zip (30.1 KB)

3 Likes