Skip to content

Jejebecarte/minecraft-text-canvas

Repository files navigation

Minecraft Text Canvas

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

Installation

This package requires Node.js =>10.20.0.

Install via the package manager of your choice:

$ npm install minecraft-text-canvas

Supported Markup

Click to view
Name Character
Dark Red &4
Red &c
Gold &6
Yellow &e
Dark Green &2
Green &a
Aqua &b
Dark Aqua &3
Dark Blue &1
Blue &9
Light Purple &d
Dark Purple &5
White &f
Gray &7
Dark Gray &8
Black &0
Bold &l
Reset &r
Newline \n

Usage

The following example simply renders an example input text with some basic markup:

import render from 'minecraft-text-canvas';
const result = render('&cExample &r&btext');

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.

Acknowledgements

This repository is based off the hypixel-fake-chat generator.

License

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