'#'+('00000'+(Math.random()*0x1000000<<0).toString(16)).slice(-6); // or '#' + Math.floor(Math.random() * 0xffffff).toString(16).padEnd(6, '0');