1.1.1 • Published 7 years ago

random-color-js v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
7 years ago

RandomColor

Module with API that allows you to generate colors and create your own script using the built functions.

Version

1.1.1

Installation

npm
npm install random-color-js
Github

You can also download files from github.

Usage

On production use files only from dist/ folder

Include script
<script src="randomColor.min.js"></script>  

API

Example

You can access to the module function by write randomColor.function() or rc.function()

// Generate random RGB color -> rgb(x, y, z)
var rgb = randomColor.rgb();

// Generate random Hex color -> #xxyyzz
var hex = randomColor.hex();

// Convert the rgb color to Hex color -> #xxyyzz
var convert = randomColor.rgbToHex(rgb);

// Change background-color in the given elements
randomColor.setColor(['tag', '#id', '.class'], rgb, 'background-color');
Options
FunctionType of parametersDescription
.rgb()noneReturns the RGB color
.hex()noneReturns the Hex color
.rgbToHex(color)stringConvert the rgb color to Hex color
.setColor(elements, color, style)object, string, stringChange the color of the element
.showCode(color, element)string, stringShow color code in the element
1.1.1

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago