random-srgb-color

1.0.0 • Public • Published

random-srgb-color

Generate a random srgb color.

Installation

npm install --save random-srgb-color

Usage

var randomSRGBColor = require('random-srgb-color')


randomSRGBColor() // => color(srgb .74 .21 .45)
randomSRGBColor(0, 1, 0, 1, 0, 1, 0, 1); // => color(srgb .10 .88 .42 / .62)
randomSRGBColor(0, 100, 0, 100, 0, 100); // => color(srgb 73% 58% 24%)
randomSRGBColor(0, 100, 0, 100, 0, 100, 0, 100); // => color(srgb 34% 58% 73% / 50%)

or

import randomSRGBColor from 'random-srgb-color'

randomSRGBColor() // => color(srgb .74 .21 .45)
randomSRGBColor(0, 1, 0, 1, 0, 1, 0, 1); // => color(srgb .10 .88 .42 / .62)
randomSRGBColor(0, 100, 0, 100, 0, 100); // => color(srgb 73% 58% 24%)
randomSRGBColor(0, 100, 0, 100, 0, 100, 0, 100); // => color(srgb 34% 58% 73% / 50%)

Acknowledgements

Inspired by random-hex-color by John Otander which is repackaged from a post by Paul Irish.

License

MIT

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Crafted for generative doings by Adam Morse (@mrmrs_).


Package Sidebar

Install

npm i random-srgb-color

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

3.63 kB

Total Files

4

Last publish

Collaborators

  • mrmrs