minecraft-text-canvas
TypeScript icon, indicating that this package has built-in type declarations

1.2.1 • Public • Published

Minecraft Text Canvas

A simple TypeScript application to generate images of Minecraft text using markup.

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

Click to view
Name Code
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.

Package Sidebar

Install

npm i minecraft-text-canvas

Weekly Downloads

1

Version

1.2.1

License

MIT

Unpacked Size

35.1 MB

Total Files

56

Last publish

Collaborators

  • jejebecarte