获取随机颜色
方法一:
function randomColor1() { var rand = Math.floor(Math.random() * 0xFFFFFF).toString(16); if(rand.length == 6){ return rand; }else{ return randomColor(); } }
方法二:
function randomColor2(){ return ‘#‘+(‘00000‘+(Math.random()*0x1000000<<0).toString(16)).slice(-6); }
时间: 2024-10-29 19:06:15