mc-chalk
v1.0.3
Published
[日本語版はこちら](README.ja.md)
Maintainers
Readme
mc-chalk
Small library for building Minecraft Bedrock formatting-code strings with an API similar to Node.js chalk.
When you write chalk.red("text") or chalk.bold.yellow("warning"), it returns a string with Minecraft § formatting codes.
Install
npm install mc-chalkUsage
import { chalk } from "mc-chalk";
const message = chalk.bold.green("Hello, Bedrock!");
const warning = chalk.bold.red("Warning");
const material = chalk.italic.amethyst("Shard");
console.log(message);
console.log(`${warning}: low durability`);
console.log(material);The return value is a plain string.
const text: string = chalk.aqua("Water");Chaining
You can chain multiple styles.
chalk.bold.red("Error");
chalk.italic.darkAqua("Info");
chalk.obfuscated.white("Secret");Generated strings concatenate Minecraft formatting codes from left to right.
chalk.bold.red("Red!");
// => "§l§cRed!"Available Styles
resetobfuscatedbolditalicblackdarkBluedarkGreendarkAquadarkReddarkPurplegoldgraydarkGraybluegreenaquaredlightPurpleyellowwhiteminecoinGoldquartzironnetheriteredstonecoppermaterialGoldemeralddiamondlapisamethystresin
Example
import { world } from "@minecraft/server";
import { chalk } from "mc-chalk";
world.sendMessage(chalk.bold.yellow("Server is ready"));
world.sendMessage(`${chalk.red("Alert")}: boss spawned`);