Hey Folks!
Today I came up with this colour generator function.
This can be a really cool projects for newbie developers!
Well as the name suggests, it will randomly assign a new colour to the body of HTML page.
I am sharing my GitHub repository link for the same,which contains these functions in "script.js"
1) getRandomColor()
2) getRandomColorLight()
3) getRandomColorDark()
I would recommend you to have a look at it.
https://github.com/prakhart111/ColorFlipper
Hope You liked it!
and comment down your way to do the same.
Follow me on:
Twitter : https://twitter.com/PrakharTandon29
GitHub : https://github.com/prakhart111
Top comments (9)
You should use
s.length
instead of 16 inline:8
. So you don't have to hardcode.Yes! thanks for the suggestion:)
It wouldn't be better to randomize 3 numbers from 0 to 255 convert to hex and concat them?
Hey DevFranPR,
Yeah, this one will also work fine.
Actually there are several possible ways to perform this operation, will try to enlist them all in my next article.
Stay Tuned !
Nice! Follow
And Share this article !
Connect with me on twitter as well ( link in the post )
Thanks for the precise and nice explaination man, I myself wasn't aware of this ES6 approach.
Thanks @lukeshiru for such a detailed explanation.
Can you please explain this approach, specially getRangedRandomColor function.