this is for material design's color library.
sometimes, I need a color when I make mock design or framework in markup. it's slightly troublesome to choose color and check design. additionally, I'm usually using React.js or lit-html or something which generates HTML from javascript.
if it can be used like uuid, that would be nice, so I made it!
Example page is here
and Example code is here
first, you need below.
$ yarn add material-random-color-picker
or
$ npm i material-random-color-picker
and then, you need to import mrcp()
.
import mrcp from 'material-random-color-picker';
mrcp() // it will be rendered color randamly like #FFFFFF;
Basically, I refered to material design's color. Especially this page
if you got confused how to set option such as color
, type
, and level
, please refer above page.
mrcp(option)
option
: type is objectcolor
: default isnull
and type is stringtype
: default isnull
and type is stringlevel
: default isnull
and type is numberisObject
: default is false and type is boolean
mrcp({color: 'red', type: 'lighten'})
// #ef9a9a
mrcp({isObject: true, level: 1})
// { code: "#84ffff", color: "cyan", id: 109, level:1, type: "accent" }
// just in case, id is a internal id. you don't need to care of it.