Crates.io | azalea-chat |
lib.rs | azalea-chat |
version | 0.10.2 |
source | src |
created_at | 2022-08-30 02:49:02.590266 |
updated_at | 2024-06-14 00:31:35.280864 |
description | Parse Minecraft chat messages. |
homepage | |
repository | https://github.com/azalea-rs/azalea/tree/main/azalea-chat |
max_upload_size | |
id | 654911 |
size | 71,078 |
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"
);