Crates.io | azalea-chat |
lib.rs | azalea-chat |
version | 0.10.3+mc1.21.1 |
source | src |
created_at | 2022-08-30 02:49:02.590266 |
updated_at | 2024-10-23 04:29:56.282712 |
description | Parse Minecraft chat messages. |
homepage | |
repository | https://github.com/azalea-rs/azalea/tree/main/azalea-chat |
max_upload_size | |
id | 654911 |
size | 68,734 |
Things for working with Minecraft formatted text components.
// convert a Minecraft formatted text JSON into colored text that can be printed to the terminal.
use azalea_chat::FormattedText;
use serde_json::Value;
use serde::Deserialize;
let j: Value = serde_json::from_str(
r#"{"text": "hello","color": "red","bold": true}"#
)
.unwrap();
let text = FormattedText::deserialize(&j).unwrap();
assert_eq!(
text.to_ansi(),
"\u{1b}[1m\u{1b}[38;2;255;85;85mhello\u{1b}[m"
);