taro icon indicating copy to clipboard operation
taro copied to clipboard

function getRandomHEXColor

Open KL0maboi opened this issue 3 years ago • 3 comments

adding getRandomHEXColor function to generate random hex codes

KL0maboi avatar Apr 09 '22 14:04 KL0maboi

you can make this with modd.io scripts but its just long and pain this can finish it in just a function

KL0maboi avatar Apr 09 '22 14:04 KL0maboi

Cool stuff, but what would be the practical use of this? I think you should at least make it able to get a random hex code between a range of values, for example random color between #000020 and #0000FF (each third of the code would have its own range since hex color codes are three two-digit numbers together)

420kyle69 avatar Apr 09 '22 20:04 420kyle69

Also:

returnValue = '#' + Math.floor(Math.random() * 0xffffff).toString(16).padStart(6, '0')

:trollface:

Plus, you're using a global variable i in your for loop (line 979), declare it with let instead

420kyle69 avatar Apr 09 '22 20:04 420kyle69