+ 9

Can javascript calculate result from mixing colors?

I found this comment.

4th Sep 2018, 4:19 AM
Mark đŸ‡ș🇬 [INACTIVE]
Mark đŸ‡ș🇬 [INACTIVE] - avatar
3 Answers
+ 8
yes <button onclick="getRandomColor()">Background color change</button> <script> function getRandomColor() { var letters = '0123456789ABCDEF'; var color = '#'; for (var i = 0; i < 6; i++ ) { color += letters[Math.floor(Math.random() * 16)]; } var q = document.getElementsByTagName("body")[0]; q.style.backgroundColor = color; } </script>
4th Sep 2018, 4:24 AM
Sudarshan Rai
Sudarshan Rai - avatar
+ 4
Shudarshan Rai👑 thanks, I'll try it out then.
4th Sep 2018, 6:20 AM
Mark đŸ‡ș🇬 [INACTIVE]
Mark đŸ‡ș🇬 [INACTIVE] - avatar
+ 4
👌
4th Sep 2018, 6:24 AM
Sudarshan Rai
Sudarshan Rai - avatar