@hexze/mctext 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,84 @@
1
+ # mctext
2
+
3
+ Minecraft text formatting, parsing, and rendering library. Features all the exact glyphs used ingame, for the fonts of both pre and post-1.13.
4
+
5
+ ## Language Support
6
+
7
+ | Language | Package | Registry |
8
+ |----------|---------|----------|
9
+ | Rust | `mctext` | [crates.io](https://crates.io/crates/mctext) |
10
+ | Python | `mctext` | [PyPI](https://pypi.org/project/mctext) |
11
+ | JavaScript | `@hexze/mctext` | [npm](https://npmjs.com/package/@hexze/mctext) |
12
+
13
+ ## Features
14
+
15
+ - **Text Parsing** - Parse legacy `§` formatting codes and JSON chat components
16
+ - **Color Support** - All 16 named Minecraft colors plus RGB hex colors
17
+ - **Style Handling** - Bold, italic, underlined, strikethrough, obfuscated
18
+ - **Font Rendering** - Measure and render text with authentic Minecraft fonts
19
+
20
+ ## Font Showcase
21
+
22
+ ![Font Showcase](https://raw.githubusercontent.com/hexze/mctext/master/showcase.png)
23
+
24
+ ## Fonts Only
25
+
26
+ Looking for just the TTF files? Download them from the [releases page](https://github.com/hexze/mctext/releases):
27
+
28
+ - `minecraft-fonts-modern.zip` - Latest Minecraft fonts (updated, cleaner look)
29
+ - `minecraft-fonts-legacy.zip` - Classic fonts for those who prefer pre-1.13
30
+ - `minecraft-fonts-special.zip` - Enchanting and Illager fonts
31
+
32
+ ## Usage
33
+
34
+ ### Rust
35
+
36
+ ```toml
37
+ [dependencies]
38
+ mctext = "1.0"
39
+
40
+ # With legacy fonts:
41
+ mctext = { version = "1.0", features = ["legacy-fonts"] }
42
+ ```
43
+
44
+ ```rust
45
+ use mctext::McText;
46
+
47
+ let text = McText::parse("§cRed §lBold");
48
+ for span in text.spans() {
49
+ println!("{}: {:?}", span.text, span.color);
50
+ }
51
+ ```
52
+
53
+ ### Python
54
+
55
+ ```bash
56
+ pip install mctext
57
+ ```
58
+
59
+ ```python
60
+ import mctext
61
+
62
+ text = mctext.parse("§cRed §lBold")
63
+ for span in text.spans():
64
+ print(f"{span.text}: {span.color}")
65
+ ```
66
+
67
+ ### JavaScript
68
+
69
+ ```bash
70
+ npm install @hexze/mctext
71
+ ```
72
+
73
+ ```javascript
74
+ import { McText } from '@hexze/mctext';
75
+
76
+ const text = McText.parse("§cRed §lBold");
77
+ for (const span of text.spans()) {
78
+ console.log(`${span.text}: ${span.color}`);
79
+ }
80
+ ```
81
+
82
+ ## License
83
+
84
+ MIT
Binary file
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@hexze/mctext",
3
3
  "type": "module",
4
4
  "description": "Minecraft text formatting for JavaScript/WASM",
5
- "version": "1.0.2",
5
+ "version": "1.0.4",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",