随机生成RGB三原色
时间:2020-06-30 18:28:36
收藏:0
阅读:111
getRandomColor: function() { const rgb = [] for (let i = 0; i < 3; ++i) { let color = Math.floor(Math.random() * 256).toString(16) color = color.length == 1 ? ‘0‘ + color : color rgb.push(color) } return ‘#‘ + rgb.join(‘‘) }
原文:https://www.cnblogs.com/wangyuxue/p/13214942.html
评论(0)