2.1.0 • Published 9 months ago

@randplus/color v2.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
9 months ago

@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(random('word')); // 'limegreen'
console.log(random('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')); // '紫磨金'

Get Color Name Example:

Install color-name-lib.

npm i color-name-lib
const { hex } = require('@randplus/color');
const colorName = require('color-name-lib');

const colorHex = hex();
const name = colorName(colorHex);
console.log(`${colorHex}: ${name}`);

or use lib/color-name-lib.js.

const { hex } = require('@randplus/color');
const colorName = require('@randplus/color/lib/color-name-lib');

const colorHex = hex();
const name = colorName(colorHex);
console.log(`${colorHex}: ${name}`);

Get Support

2.0.3

9 months ago

2.1.0

9 months ago

2.0.2

9 months ago

2.0.1

9 months ago

2.0.0

9 months ago

1.0.0

9 months ago

1.0.0-dev.1

9 months ago

1.0.0-dev.0

9 months ago