mono-achievements
v0.0.2
Published
Simple library for generating monobank-like achievement images
Downloads
3
Readme
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
- Copy source code from the repo
- Install dependecies with
npm i
- Build package with
npm run build
- 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
| Property | type | description | | --- | --- | --- | | title | string | achievement title (up to 16 characters) | | description | string | achievement description (up to 160 characters) | | image | string | Buffer | path to the image or it's Buffer | | topColor | string? | css-like color declaration, default: 'blue' | | bottomColor | string? | css-like color declaration, default: 'yellow' | | closeIcon | boolean? | default: false |