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