当前位置: 首页 > 文档资料 > Mock.js 中文文档 >

Color

优质
小牛编辑
121浏览
2023-12-01

Random.color()

  • Random.color()

随机生成一个有吸引力的颜色,格式为 '#RRGGBB'。

Random.color()
// => "#3538B2"

Random.hex()

  • Random.hex()

随机生成一个有吸引力的颜色,格式为 '#RRGGBB'。

Random.hex()
// => "#3538B2"

Random.rgb()

  • Random.rgb()

随机生成一个有吸引力的颜色,格式为 'rgb(r, g, b)'。

Random.rgb()
// => "rgb(242, 198, 121)"

Random.rgba()

  • Random.rgba()

随机生成一个有吸引力的颜色,格式为 'rgba(r, g, b, a)'。

Random.rgba()
// => "rgba(242, 198, 121, 0.13)"

Random.hsl()

  • Random.hsl()

随机生成一个有吸引力的颜色,格式为 'hsl(h, s, l)'。

Random.hsl()
// => "hsl(345, 82, 71)"