Giter Club home page Giter Club logo

randomcolor's Introduction

Random Color

For generating attractive random colors. See the results on the demo.

Logo

Options

You can pass an options object to influence the type of color it produces. The options object accepts the following properties:

Hue – Controls the hue of the generated color. You can pass a string representing a color name (e.g. 'orange'). Possible color names are red, orange, yellow, green, blue, purple, pink and monochrome.

Luminosity – Controls the luminosity of the generated color. You can pass a string containing bright, light or dark.

Count – An integer which specifies the number of colors to generate.

Format – A string which specifies the format of the generated color. Possible values are hsvArray, rgb, rgbArray, and hex. The type of the generated color will vary based on the format chosen.

Examples

Here's are a few examples showing what you can do with the options object.

randomColor(); // returns a hex code e.g. '#F7A7D9'

// An array of ten green colors
randomColor({
   count: 10,
   hue: 'green'
});

// A light blue
randomColor({
   luminosity: 'light',
   hue: 'blue'
});

// A 'truly random' color
randomColor({
   luminosity: 'random',
   hue: 'random'
});

// A bright color in RGB
randomColor({
   luminosity: 'bright', // returns a bright color
   format: 'rgb' // in rgb, e.g. 'rgb(225,200,20)'
});

License

This project is licensed under the terms of the MIT license.

randomcolor's People

Contributors

davidmerfield avatar bilalq avatar lijunle avatar

Watchers

Navid Nikpour avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.