jQuery Random Colour Generator
I can’t remember the inspiration for this crazy thing, but I’m sure somewhere out there someone is looking for a random colour generator that is done in jQuery.
So if you’re feeling in the mood to have a randomly changing colour … this is the script for you! Essentially it’s just generating a random number between 0 and 255 for red, green, and blue. It then uses CSS to change the colour property of an element (that’s easily customizable by you).
gud one said:
good one yaar!!!!
emma said:
great !
erational did something similar but the colors are animated:
http://www.erational.org/randomColor.html
Dick Hollywood said:
Great!
But do you know how we can make a random with only 20 colors?
Ben said:
20 colours randomly generated at once should be very straightforward. Create a function that generates a random colour and returns its value, call it 20 times in a loop.
fred said:
is this not easier ?
function randomColor(){
return ‘#’+Math.floor(Math.random()*16777216).toString(16);
}
Ben said:
Yup, looks easier.
swapnil kene said:
right , somewhere out there someone is looking for a random colour generator .
\m/