Project description
mctext
Minecraft text formatting, parsing, and rendering library. Features all the exact glyphs used ingame, for the fonts of both pre and post-1.13.
Language Support
| Language |
Package |
Registry |
| Rust |
mctext |
crates.io |
| Python |
mctext |
PyPI |
| JavaScript |
@hexze/mctext |
npm |
Features
- Builder API - Fluent interface for constructing formatted text
- Color Support - All 16 named Minecraft colors plus RGB hex colors
- Style Handling - Bold, italic, underlined, strikethrough, obfuscated
- Font Rendering - Measure and render text with authentic Minecraft fonts
- Legacy Support - Parse
§ formatting codes and JSON chat components
Font Showcase

Installation
pip install mctext
Quick Start
import mctext
text = mctext.MCText().span("Red ").color("red").then("Bold").color("red").bold().build()
for span in text.spans():
print(f"{span.text}: {span.color}")
API Reference
MCText
| Method |
Description |
MCText() |
Create empty MCText |
MCText.parse(text) |
Parse legacy § formatted text |
MCText.parse_json(json) |
Parse JSON chat component |
span(text) |
Start building a span, returns SpanBuilder |
spans() |
Get list of text spans |
plain_text() |
Get text without formatting |
to_legacy() |
Convert to legacy § format |
to_json() |
Convert to JSON chat component |
SpanBuilder
| Method |
Description |
color(color) |
Set span color (name like "red" or hex "#FF0000") |
bold() |
Make span bold |
italic() |
Make span italic |
underlined() |
Make span underlined |
strikethrough() |
Make span strikethrough |
obfuscated() |
Make span obfuscated |
then(text) |
Add another span and continue building |
build() |
Finish building and return MCText |
Span
| Property |
Type |
Description |
text |
str |
The text content |
color |
Color |
Color (named or RGB) |
style |
Style |
Formatting flags |
Color
| Property |
Type |
Description |
name |
str |
Color name (named colors only) |
code |
str |
Format code character (named colors only) |
rgb |
tuple |
RGB tuple (r, g, b) |
r, g, b |
int |
Individual components |
Style
| Property |
Type |
Description |
bold |
bool |
Bold text |
italic |
bool |
Italic text |
underlined |
bool |
Underlined text |
strikethrough |
bool |
Strikethrough text |
obfuscated |
bool |
Randomized text |
Utility Functions
| Function |
Description |
parse(text) |
Shorthand for MCText.parse(text) |
parse_json(json) |
Shorthand for MCText.parse_json(json) |
strip_codes(text) |
Remove all § codes from text |
count_visible_chars(text) |
Count characters excluding format codes |
named_colors() |
Get all 16 named Minecraft colors |
Rendering
import mctext
text = mctext.MCText().span("Hello ").color("red").then("World").color("red").bold().build()
fonts = mctext.FontSystem.modern()
options = mctext.LayoutOptions(16.0).with_shadow(True)
result = mctext.render(fonts, text, 256, 64, options)
# result.width, result.height - dimensions
# result.data() - RGBA bytes
Rendering API
| Class/Function |
Description |
FontSystem.modern() |
Load post-1.13 fonts |
FontSystem.legacy() |
Load pre-1.13 fonts |
FontSystem.measure(text, size) |
Measure text width in pixels |
FontSystem.measure_family(text, size, family) |
Measure text with specific font family |
LayoutOptions(size) |
Create layout options with font size |
.with_shadow(bool) |
Enable drop shadow |
.with_max_width(width) |
Enable text wrapping |
.with_align(align) |
Set alignment ("left", "center", "right") |
.with_line_spacing(spacing) |
Set line spacing |
render(fonts, text, width, height, options) |
Render to RGBA buffer |
render_family(fonts, text, family, width, height, options) |
Render with specific font family |
Font Families
| Family |
Description |
FontFamily.Minecraft |
Standard Minecraft font |
FontFamily.Enchanting |
Enchanting table font |
FontFamily.Illager |
Illager runes font |
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mctext-1.3.2.tar.gz.
File metadata
-
Download URL: mctext-1.3.2.tar.gz
- Upload date:
-
Size: 29.8 kB
- Tags: Source
-
Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.11.5
File hashes
Hashes for mctext-1.3.2.tar.gz
| Algorithm |
Hash digest |
|
| SHA256 |
925c01d709c38cbf297e9b82b3a5c9bd4063f54be3e7d6bf04e5ced49db3293c
|
|
| MD5 |
88c7f16c96fd141641c0338cc7f64851
|
|
| BLAKE2b-256 |
c9a15715d48dcb2a39948523f97d73997c80550875cc5edebe92c20ccda81e00
|
|
See more details on using hashes here.
File details
Details for the file mctext-1.3.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
File hashes
Hashes for mctext-1.3.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Algorithm |
Hash digest |
|
| SHA256 |
dfacbdf0a1e9c0916e5e651f979e959ea6cc7f47f6d4d89a44f78feaa4c0caf8
|
|
| MD5 |
d41f2dc835fabc2ed1f5acbb898963a3
|
|
| BLAKE2b-256 |
baa12ad6a42deb51fc305efa98790a4079b37b59c0fcef8e759289aee9bbc402
|
|
See more details on using hashes here.
File details
Details for the file mctext-1.3.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
File hashes
Hashes for mctext-1.3.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Algorithm |
Hash digest |
|
| SHA256 |
50f9d85085df11c011e807d36208ae1486550a900799a72edef93d9d3c227f96
|
|
| MD5 |
26671307e03fc3c2a2fa75fdf90bbdf6
|
|
| BLAKE2b-256 |
f59a2ebfcc4e5bb87b70f76bf7813055ba7ff4d332f99ddbac966ae0632b71de
|
|
See more details on using hashes here.
File details
Details for the file mctext-1.3.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
File hashes
Hashes for mctext-1.3.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Algorithm |
Hash digest |
|
| SHA256 |
fab8c04aa5d40d4f0153cf37e8fb62c08e534b7d57b36fda49a6c71f391c37c3
|
|
| MD5 |
962f4297fbb51806e5d3c5e53de1c1dc
|
|
| BLAKE2b-256 |
cd85f24f1e7f8c220cda80238fb7e6cfec0ea55f781163f8c58faddeed76769d
|
|
See more details on using hashes here.
File details
Details for the file mctext-1.3.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
File hashes
Hashes for mctext-1.3.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Algorithm |
Hash digest |
|
| SHA256 |
0313b1c35dd9abee7d3992ff445f8f5b495d30e0e8489aac8d86090d5ffb9ba7
|
|
| MD5 |
cc8c80cb0f0b83ec96995f23530fc637
|
|
| BLAKE2b-256 |
48b78128f5d4ff2a767c2caa87cd3c19e8645d4b27f4641a83c4d30e4746e989
|
|
See more details on using hashes here.
File details
Details for the file mctext-1.3.2-cp311-cp311-win_amd64.whl.
File metadata
-
Download URL: mctext-1.3.2-cp311-cp311-win_amd64.whl
- Upload date:
-
Size: 23.4 MB
- Tags: CPython 3.11, Windows x86-64
-
Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.11.5
File hashes
Hashes for mctext-1.3.2-cp311-cp311-win_amd64.whl
| Algorithm |
Hash digest |
|
| SHA256 |
b01083e8d86cb18256c638fd54e7508e0ea97f96fc140a7e1861bb3b4339249f
|
|
| MD5 |
810d4424ff237e31b048fadc0728d6be
|
|
| BLAKE2b-256 |
632b9e0db3a03e2c5221944ab4c47899a89c4bfd8be3ca3a9a29f817d92a3827
|
|
See more details on using hashes here.
File details
Details for the file mctext-1.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
File hashes
Hashes for mctext-1.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Algorithm |
Hash digest |
|
| SHA256 |
4e7b5ff0f65df7c7ce24fff0941a2a6c729dc3da2e5139657557427a96ef2b0e
|
|
| MD5 |
bacf4489f2ed3d8ed0f95f4616841c97
|
|
| BLAKE2b-256 |
0189fa6de2da65959d4013109996b6ba2c5a0cb9fa139db9792387e4d3024ec9
|
|
See more details on using hashes here.
File details
Details for the file mctext-1.3.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
File hashes
Hashes for mctext-1.3.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Algorithm |
Hash digest |
|
| SHA256 |
bdbd5d6eb7589daf84fcb8f567aee9fd01096d76baf37aca578a11dfee1b2b02
|
|
| MD5 |
c39d814d8203f58c9966be51e9f1f007
|
|
| BLAKE2b-256 |
b22cd384be7cf33fb3fa861e3d6e4d478b0da40f867785064169b5185e281b6b
|
|
See more details on using hashes here.
File details
Details for the file mctext-1.3.2-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
File hashes
Hashes for mctext-1.3.2-cp311-cp311-macosx_11_0_arm64.whl
| Algorithm |
Hash digest |
|
| SHA256 |
e36317e1cc0d83d817a3ee22efa7b3af48b32b56fb96fdea09d0b86968f72615
|
|
| MD5 |
e57b2d9744744418ef4777da42c0b4cd
|
|
| BLAKE2b-256 |
cb1a4e3d6a5d70dcf03976138c8adb89d09bccc4cb819e84e37bed0358882fed
|
|
See more details on using hashes here.
File details
Details for the file mctext-1.3.2-cp311-cp311-macosx_10_12_x86_64.whl.
File metadata
File hashes
Hashes for mctext-1.3.2-cp311-cp311-macosx_10_12_x86_64.whl
| Algorithm |
Hash digest |
|
| SHA256 |
81268fb7a4d2d2825b1173a300392add2fee8a6437e9fa12f4ef6be848e71db0
|
|
| MD5 |
a71356bfe17d1a0e08278de3d98733c5
|
|
| BLAKE2b-256 |
19d9359642e33305c3824b647678005a6a3706237c54d754259767c23088fcf4
|
|
See more details on using hashes here.
File details
Details for the file mctext-1.3.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
File hashes
Hashes for mctext-1.3.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Algorithm |
Hash digest |
|
| SHA256 |
1e13f1b061c9ae43e75f767027f095da93254e9d669666d8083eabb40ba6e99c
|
|
| MD5 |
1e4fb030375360c0fdda681419f4eeaa
|
|
| BLAKE2b-256 |
84ae7e6adf5b1e0cdb9e1e49e70c1c21bda9790c3860a1ab96fa18801e7bb8d4
|
|
See more details on using hashes here.
File details
Details for the file mctext-1.3.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
File hashes
Hashes for mctext-1.3.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Algorithm |
Hash digest |
|
| SHA256 |
fa5df394f0acb548d61f27f638175da485608d3c12d05b57f4a70ccb2da4bf7f
|
|
| MD5 |
96217683a560f8ae80fb8b7a765335d7
|
|
| BLAKE2b-256 |
cdb193e81fe3fc37d779f5f76e5492733c4a6ab5932ee75946ef43aba2cf31e3
|
|
See more details on using hashes here.
File details
Details for the file mctext-1.3.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
File hashes
Hashes for mctext-1.3.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Algorithm |
Hash digest |
|
| SHA256 |
38599934989ace93583763ef331438f3db0e072e551ec664ead32aaf0255d7d3
|
|
| MD5 |
b7536e86506017408afe31ef9ea4686b
|
|
| BLAKE2b-256 |
16df1884a7bc2666ce9cf87a844a62cb66f75911aeaf00faaf0eb0be826243c2
|
|
See more details on using hashes here.
File details
Details for the file mctext-1.3.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
File hashes
Hashes for mctext-1.3.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Algorithm |
Hash digest |
|
| SHA256 |
e06fea0a23a0d68a877266b7681c6dc12a335536af756765229c5b28f84fb365
|
|
| MD5 |
da0d868f086b6753843daa15377de3bb
|
|
| BLAKE2b-256 |
ed524eadf8c625138f7ec643f4a485a03fe44772a51282c847711c492b4efb29
|
|
See more details on using hashes here.