function randomColor() {
let r = Math.floor(Math.random()*256);
let g = Math.floor(Math.random()*256);
let b = Math.floor(Math.random()*256);
//返回随机生成的颜色
return "rgb(" r "," g "," b ")";
}
console.log = (function(oriLogFunc){
return function(...data)
{
const icons = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "⚽", "", "", "", "⭕", "❌", "❓", "❗", ""]
const icon = icons[Math.floor(Math.random() * icons.length)];
const bgColor = randomColor()
const color = randomColor()
oriLogFunc.call(console,`%c ${icon} `, `border-radius:5px;padding:12px;border:1px solid #000;color: #43bb88;font-size: 16px;font-weight: bold;text-decoration: underline;`, ...data);
}
})(console.log);
- https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce
- https://www.jianshu.com/p/a2f2a7eeb662