Socket
Socket
Sign inDemoInstall

colour-range

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

colour-range

Get a wide list of unique colours, based on shifting the hue of the colours


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

colourRange(range, options) ⇒ Array.<string>

Get as wide a list of unique colours as possible, based on shifting the hue of the colours

Samples from the 'colour wheel' at equally spaced intervals, where red (#ff0000 / rgb(255, 0, 0) / hsl(0, 1, 0.5)) is the starting point.

colour wheel

For example: calling colourRange(3) will give you 3 colours as wide apart as possible, in this case red, blue, and green [ 'ff0000', '00ff00', '0000ff' ]

This works for providing up to 360 unique colours

Kind: global function
Returns: Array.<string> - - List of unique hex values

ParamTypeDefaultDescription
rangenumber1Number of unique colours to produce, maximum is 360
optionsObject
[options.saturation]number1Saturation of colours
[options.lightness]number0.5Lightness of colours
[options.prefix]booleanfalsePrefix the colours with a '#'

Example

import colourRange from 'colour-range'

colourRange(3)
// [ 'ff0000', '00ff00', '0000ff' ] (RGB)
colourRange(3, { prefix: true })
// [ '#ff0000', '#00ff00', '#0000ff' ]
colourRange(3, { saturation: 0.6, lightness: 0.2, prefix: true })
// [ '#521414', '#145214', '#141452' ]
colourRange(360)
// [ 'ff0000', ..., 'ff0004' ]

Keywords

FAQs

Package last updated on 27 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc