Skip to content

ChrisIsNot/rainbow-gradient

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rainbow Gradient Tweet

Generates a gradient of the colors of the rainbow.

version minified size minzipped size downloads build

Install

  • npm install rainbow-gradient --save or
  • yarn add rainbow-gradient

Use

import rainbowGradient from 'rainbow-gradient';

// Creates an array with three colors:
rainbowGradient(3);

// Creates an array with 10 colors, darkened and washed out:
rainbowGradient(10, 0.5, 0.25);

Parameters

  • length

    The number of colors in the resulting gradient array.

  • saturation

    The saturation of the colors. 0 represents grayscale. 1 represents full color. Default: 1.

  • lightness

    The lightness of the colors. 0 represents black. 1 represents white. Default: 0.5.

Return Value

The function returns an array of colors based on the parameters. Each color is an array of red, green, and blue values from 0 to 255.

Example:

rainbowGradient(3) returns:

[
  [ 255, 0, 0 ],
  [ 0, 255, 0 ],
  [ 0, 0, 255 ]
]

About

Generates a gradient of the colors of the rainbow.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 100.0%