|
|
请马上登录,朋友们都在花潮里等着你哦:)
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 马黑黑 于 2023-3-28 21:33 编辑
一、十六进制:
let color = `#${Math.random().toString(16).substr(-6)}`;
二、RGB:
let color = `rgb(${Math.ceil(Math.random()*255)},${Math.ceil(Math.random()*255)},${Math.ceil(Math.random()*255)})`;
三、HSL:
let color = `hsl(${Math.ceil(Math.random()*360)},${Math.ceil(Math.random()*100)}%,${Math.ceil(Math.random()*100)}%)`;
四、预定义色:
let colorAr = ['red','orange','yellow','green','cyan','blue','purple'];
let color = colorAr[Math.floor(Math.random()*colorAr.length)];
演示:JS生成随机颜色 (freeee.ml)
|
评分
-
| 参与人数 2 | 威望 +100 |
金钱 +200 |
经验 +100 |
收起
理由
|
红影
| + 50 |
+ 100 |
+ 50 |
赞一个! |
小辣椒
| + 50 |
+ 100 |
+ 50 |
赞一个! |
查看全部评分
|