A while ago I played around with something similar. I needed to generate a bunch of random colors but that always looked awful, so i ended up writing this little snippet:
/* @param alpha boolean
* if true a random value for the alpha channel is calculated, else alpha channel = 1 (full saturation)
*/varrandomPastelColor=function(alpha){varrndm=function(f){returnMath.floor(Math.random()*f)},pstlfy=function(p){returnMath.round((p+255)/2)},r=pstlfy(rndm(256)),g=pstlfy(rndm(256)),b=pstlfy(rndm(256)),a=alpha?rndm(11)/10:1return'rgba('+r+','+g+','+b+','+a+')'}
It generates random pastel colors, which are easier on the eyes in my opinion. The trick to "pastelify" is to just take each individual value add 255 (or FF) and divide it by two ✨
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
A while ago I played around with something similar. I needed to generate a bunch of random colors but that always looked awful, so i ended up writing this little snippet:
gist.github.com/herrfugbaum/7a6530... (I didn't get the embedding working 😂)
It generates random pastel colors, which are easier on the eyes in my opinion. The trick to "pastelify" is to just take each individual value add 255 (or FF) and divide it by two ✨