random-linear-srgb-color

1.0.0 • Public • Published

random-linear-srgb-color

Generate a random linear sRGB color.

Installation

npm install --save random-linear-srgb-color

Usage

var randomLinearSRGBColor = require('random-linear-srgb-color');

// Generate random linear sRGB color as a string
console.log(randomLinearSRGBColor()); // color(linear-srgb 0.74 0.21 0.45)
console.log(randomLinearSRGBColor(0, 1, 0, 1, 0, 1, 0, 1)); // color(linear-srgb 0.10 0.88 0.42 / 0.62)

// Generate random linear sRGB color as an object
console.log(randomLinearSRGBColor(0, 1, 0, 1, 0, 1, 0, 1, true));
// { red: 0.85, green: 0.37, blue: 0.63, alpha: 0.92 }

or

import randomLinearSRGBColor from 'random-linear-srgb-color';

// Generate random linear sRGB color as a string
console.log(randomLinearSRGBColor()); // color(linear-srgb 0.74 0.21 0.45)
console.log(randomLinearSRGBColor(0, 1, 0, 1, 0, 1, 0, 1)); // color(linear-srgb 0.10 0.88 0.42 / 0.62)

// Generate random linear sRGB color as an object
console.log(randomLinearSRGBColor(0, 1, 0, 1, 0, 1, 0, 1, true));
// { red: 0.85, green: 0.37, blue: 0.63, alpha: 0.92 }

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_).


/random-linear-srgb-color/

    Package Sidebar

    Install

    npm i random-linear-srgb-color

    Weekly Downloads

    0

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    4.05 kB

    Total Files

    4

    Last publish

    Collaborators

    • mrmrs