js 随机色

    //生成随机色
    function colorRandom() {
        colorStr = "#" + ("00000" + (Math.random() * 0x1000000 << 0).toString(16)).slice(-6);
        return colorStr;
//        var r=Math.floor(Math.random()*256);
//        var g=Math.floor(Math.random()*256);
//        var b=Math.floor(Math.random()*256);
//        return `rgb(${r},${g},${b})`;

    };
原文地址:https://www.cnblogs.com/xzma/p/7600839.html