0.0.2 • Published 1 year ago

mono-achievements v0.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

About

This is a small package for creating Monobank-like achievement images

Installation

From npm

As a dependence:

$ npm i mono-achievements

Globally:

$ npm i -g mono-achievements

From source code

  1. Copy source code from the repo
  2. Install dependecies with npm i
  3. Build package with npm run build
  4. Next, install package globally using npm link

To install package as a dependence, go to your project's directory and execute following command: npm link mono-achievements

Usage

In your project

import { MonoAchievement } from 'mono-achievements'

void (async () => {
  const achievement = new MonoAchievement({
    topColor: '#EEAA22',
    bottomColor: 'rgb(230, 40, 20)',
    title: 'Lorem ipsum',
    description: 'Dolor sit amet, ... mauris',
    image: 'path/to/your/image.png',
    closeIcon: true
  })

  await achievement.load()
  const buffer = achievement.toBuffer()
  // Then you can save image with fs
})()

CLI

CLI equivalent:

$ mono --bg-top "#EEAA22" --bg-bottom "rgb(230, 40, 20)" -t "Lorem ipsum" -d "Dolor sit amet, ... mauris" -i "path/to/your/image.png" -c -o image.png

Properties

Propertytypedescription
titlestringachievement title (up to 16 characters)
descriptionstringachievement description (up to 160 characters)
imagestring | Bufferpath to the image or it's Buffer
topColorstring?css-like color declaration, default: 'blue'
bottomColorstring?css-like color declaration, default: 'yellow'
closeIconboolean?default: false
0.0.2

1 year ago

0.0.1

1 year ago