Gives you quick access to colors from popular palettes.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.editorconfig
.gitattributes
.gitignore
.travis.yml
colors.js
index.js
license
package.json
readme.md
test.js

readme.md

opaline Build Status Coverage Status

Gives you quick access to colors from popular palettes.

See also opaline-cli.

Install

Ensure you have Node.js version 6+ installed. Then run the following:

$ npm install --save opaline

Usage

const opaline = require('opaline');

opaline.hex('md', 'red', 'a200');
//=> '#FF5252'

opaline.rgb('ios', 'yellow');
//=> 'rgb(255, 204, 0)'

opaline.raw('flat', 'green');
//=> { r: 46, g: 204, b: 113, hex: 2ECC71 }

API

.list(palette, color)

Get the list of colors (or hue for Material Design if you specify a color)

['red','orange','yellow','green','teal-blue','blue','purple','pink']

.hex(palette, color, hue)

Get the hex value.

'#FFFFFF'

.rgb(palette, color, hue)

Get the rgb value.

'rgb(255, 255, 255)'

.raw(palette, color, hue)

Get the raw rgb and hex value (as an object).

{ r: 255, g:255, b:255, hex: 'FFFFFF' }

palette

Type: string

Name of the color palette. Possible values:

  • ios: iOS color palette
  • md: Material Design color palette
  • flat: Flat color palette
  • clrs: Colors.css palette

color

Type: string

Name of the color.

hue

Type: string
Default: 500

Because some color palettes (like Material Design) have 'hues', you can specify the color hue.

Contributing

Remarks, advices & contributions are welcome. Feel free to open an issue or submit a pull request.

License

MIT © Maxime Le Conte des Floris