usabilla / button-generator

Node module that generates a button image.
1 stars 0 forks source link

Button Generator

This node module generates a buffer of a button png image based on a set of parameters. It is used in the Usabilla Themes Publisher to create feedback buttons.

Setup

yarn install

Usage

For generating a button we require these properties:

Example

const options = {
  fontCssUrl: '//fonts.googleapis.com/css?family=Open+Sans',
  fontFileUrl: 'http://www.amazon.com/my-font.woff',
  fontName: 'Open Sans',
  fontSize: 18,
  backgroundColor: '#000000',
  textColor: '#fff',
  borderRadius: 3,
  width: 40,
  height: 130,
  text: 'Feedback',
  edge: 'left'
};
const button = new ButtonGenerator(options);
button
  .generate()
  .then(buffer => console.log(buffer))