random colour generator html code example Example: how to use random color in html code var randomColor = Math.floor(Math.random()*16777215).toString(16);