0

Why does the letter 'O' not change color

I have code, when I type in 'red' for the color it works but when I use a hex code it doesn't what am I doing wrong? Code: ``` rand = Math.PI * ((Math.random() * 100) / 360); rand = rand / Math.PI; rand = (rand + 1) * ((Math.PI) - 1); rand = rand / 10; rand = rand + (Math.random() * 10); rand = Math.abs(rand); rand = rand - (Math.random() * 9); rand = (Math.abs(rand) * Math.PI) / 5; rand = rand * 360; rand = rand / (Math.random() * 10); if(rand > 1000) { rand = rand / (15 + Math.round(Math.random())); } frand = Math.round(rand) - 1; hue = Math.floor(rand * 10000); document.write("<h2>Size: "+rand+"</h2>"); document.write("<h2>Fitted size: "+frand+"</h2>"); document.write("<h2>Hue: "+hue+"</h2>"); document.write("<style>p {color:"+hue+"; font-size:"+frand+"px;}</style>"); document.write("<p>O<br/></p>"); ``` I expected the 'O' to change color but it doesn't.

24th May 2019, 4:56 PM
CALIN BAENEN
CALIN BAENEN - avatar
1 ответ
+ 1
your hue is in decimal, not hexadecimal. you'll need to format the number like this #XXYYZZ
24th May 2019, 6:16 PM
Taste
Taste - avatar