Skip to content

Take any JavaScript data and get back a reasonably unique hex or rgb color with an optional alpha channel ๐Ÿ–Œ

License

Notifications You must be signed in to change notification settings

thesephist/korona

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

6 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Korona

Take any JavaScript data and get back a reasonably unique hex or rgb color with an optional alpha channel ๐Ÿ–Œ

Usage

Korona is just a function.

const korona = require('korona');

korona('some_data');
// => '#abcdef' [some hex value]

Korona takes an optional options hash as the second argument:

const korona = require('korona');

korona('some_data', {mode: 'hex'});
// => '#abcdef' [default mode is hex]
korona('some_data', {mode: 'rgb'});
// => 'rgb(1, 2, 3)' [the same hex value, but in RGB format]
korona('soem_data', {alpha: true});
// => '#abcdef01' [by default, alpha is false]
//  alpha: true will add a fourth, alpha channel to both the hex and rgb modes.

The two options can obviously be combined:

korona('some_data', {mode: 'rgb', alpha: true});
// => 'rgba(1, 2, 3, 0.4)'

License

MIT. See LICENSE.

About

Take any JavaScript data and get back a reasonably unique hex or rgb color with an optional alpha channel ๐Ÿ–Œ

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published