1.0.1 • Published 1 year ago

@chriscodesthings/random-rgb-color v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

random-rgb-color Test workflow status NPM Version License: MIT

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);
} 

See Also...