rgba
function getColor() {
var colors
= "rgba(";
for (var i
= 0; i
< 3; i
++) {
colors
+= Math
.floor(Math
.random() * 256) + ",";
}
colors
+= Math
.random().toFixed(1) + ")";
return colors
}
console
.log(getColor())
十六进制
function getColor1(){
var colors
="#";
for(var i
=0;i
<6;i
++){
colors
+=Math
.floor(Math
.random()*16).toString(16)
}
return colors
}
console
.log(getColor1())
转载请注明原文地址: https://yun.8miu.com/read-135891.html