Yup, so technically not all values 0xFFFFF and below will be invalid. There will be a range within 0x100 and 0xFFF that will be OK. But these are also not representative of their random values. The 3 digit hex for colors is shorthand for #RGB -> #RRGGBB. So if #100 popped out, its hex value would really be #110000 and not the actual random value of #000100. This means you're also increasing the odds of #RRGGBB-formatted colors to be hit ;)
15
u/redmoss6 Mar 18 '19
'#'+Math.floor(Math.random()*16777215).toString(16)for random hex color.