// 随机十六进制代码, eg: #ff0000
function randomColor(){
return '#'+Math.floor(Math.random() * 0xffffff).toString(16).padEnd(6, '0');
}
JavaScript - 生成随机颜色值,随机十六进制代码
最新推荐文章于 2023-10-08 23:07:36 发布
// 随机十六进制代码, eg: #ff0000
function randomColor(){
return '#'+Math.floor(Math.random() * 0xffffff).toString(16).padEnd(6, '0');
}