A simple TypeScript application to generate images of Minecraft text using markup.
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-canvasThe 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.
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 |
This repository was inspired by hypixel-fake-chat.
This is an open-source project under the MIT License.