1.2.1 • Published 10 months ago

minecraft-text-canvas v1.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Installation

This package requires Node.js =>18.12.0.

Install via the package manager of your choice:

$ npm install minecraft-text-canvas
$ yarn add minecraft-text-canvas
$ pnpm add minecraft-text-canvas

Usage

The following example renders a sample input text with some basic markup:

import render, { CHAT_CODES } from 'minecraft-text-canvas';

const result = render(`${CHAT_CODES.RED.code}Example ${CHAT_CODES.AQUA.code}text`);

The result variable is of type TextCanvasResult, which allows the image to be retrieved as a PNG/JPEG Buffer or a PNG/JPEG Stream.

For usage examples pertaining to Streams, see the node-canvas documentation on creating PNG and JPEG streams.

Supported markup

NameCode
Black&0
Dark Blue&1
Dark Green&2
Dark Aqua&3
Dark Red&4
Dark Purple&5
Gold&6
Gray&7
Dark Gray&8
Blue&9
Green&a
Aqua&b
Red&c
Light Purple&d
Yellow&e
White&f
Bold&l
Strikethrough&m
Underline&n
Italic&o
Reset&r
Newline\n

Acknowledgements

This repository was inspired by hypixel-fake-chat.

License

This is an open-source project under the MIT License.

1.2.0

10 months ago

1.1.1

10 months ago

1.2.1

10 months ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago