@chriscodesthings/random-rgb-color
v1.0.1
Published
Generates a random color in RGB format
Downloads
28
Maintainers
Readme
random-rgb-color
Generates a random color in RGB format
Description
Generates a random color in RGB format and returned as an array.
See...
Install
npm install --save @chriscodesthings/random-rgb-color
Usage
import randomRGBColor from '@chriscodesthings/random-rgb-color';
console.log(randomRGBColor());
// => [78, 143, 28]
Types
This package uses types from:
Syntax
randomRGBColor((tone));
Parameters
- tone (optional): If true, colour is dark, if false, colour is light, based on YIQ calculation.
Return Value
Returns an array containing red, green and blue values from 0 to 255.
Examples
// random colour that should look ok with black text
function pickBackgroundColour() {
return randomRGBColor(false);
}