生成一个随机的颜色数组

  1. 生成一个随机的颜色数组-react
const colorList = Array.from({ length: 10 }, () => {
  const r = Math.floor(Math.random() * 256);
  const g = Math.floor(Math.random() * 256);
  const b = Math.floor(Math.random() * 256);
  return `rgb(${r}, ${g}, ${b})`;
});