随机的RGB和16进制颜色

242 阅读1分钟
  • 随机RGB颜色方法 'rgb('+ parseInt(Math.random() * 256) + ',' + parseInt(Math.random() * 256) + ',' + parseInt(Math.random() * 256) + ')'

  • 随机16进制颜色

'#' + parseInt(Math.random() * 0xffffff).toString(16)