@randplus/color
v2.0.2
Published
generate random colors. This package is included in 'randplus'.
Downloads
400
Maintainers
Readme
@randplus/color
Generate random colors. This package is included in 'randplus'.
Usage
// Classic
const random = require('@randplus/color');
console.log(random('hex')); // '000000' ~ 'ffffff'
console.log(random('hex', { prefix: '#' })); // '#000000' ~ '#ffffff'
console.log(random('rgb')); // [0, 0, 0] ~ [255, 255, 255]
console.log(color('word')); // 'limegreen'
console.log(color('word', { language: 'ja' })); // '鉄色'
// Advanced
const { hex, rgb, word } = require('@randplus/color');
console.log(hex()); // '000000' ~ 'ffffff'
console.log(hex('#')); // '#000000' ~ '#ffffff'
console.log(rgb()); // [0, 0, 0] ~ [255, 255, 255]
console.log(word()); // 'limegreen'
console.log(word('cn')); // '紫磨金'