This package has been deprecated

Author message:

It's a secret now

samai

0.3.3 • Public • Published

Samai

Pseudo-randomly generated patterns inspired by the Kente cloth tradition of Ghana.

Example

var options = {
    date: new Date('01-18-2018'),
    width: 400,
    dark_colors: ['#900', '#072'],
    light_colors: ['#AA6', '#990', '#222'],
    fabric_enabled: true,
    n: 37
};
var samai = new Samai(options);
var body = document.querySelector('body');
samai.getPNG().then(src => {
    body.style.backgroundSize = samai.width + 'px';
    body.style.background = "url('" + src + "')";
});

This code produces the following pattern:

pattern example

Dependencies

SVG.js (npm) (cdnjs)

Documentation

Check the jsdoc for more information.

Package Sidebar

Install

npm i samai

Weekly Downloads

82

Version

0.3.3

License

MIT

Last publish

Collaborators

  • npm